Skip to content

GENERATED BY DEFAULT AS IDENTITY in CREATE TABLE statement#1329

Merged
zachmu merged 7 commits intomainfrom
zachmu/serial-id
Mar 26, 2025
Merged

GENERATED BY DEFAULT AS IDENTITY in CREATE TABLE statement#1329
zachmu merged 7 commits intomainfrom
zachmu/serial-id

Conversation

@zachmu
Copy link
Copy Markdown
Member

@zachmu zachmu commented Mar 25, 2025

Fixes #1328

@zachmu zachmu requested a review from Hydrocharged March 25, 2025 22:18
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2025

Main PR
covering_index_scan_postgres 384.21/s 386.52/s +0.6%
index_join_postgres 151.54/s 156.03/s +2.9%
index_join_scan_postgres 187.36/s 188.86/s +0.8%
index_scan_postgres 12.52/s 12.54/s +0.1%
oltp_point_select 2721.95/s 2719.53/s -0.1%
oltp_read_only 1832.41/s 1853.86/s +1.1%
select_random_points 109.78/s 111.31/s +1.3%
select_random_ranges 137.72/s 137.93/s +0.1%
table_scan_postgres 10.19/s 10.31/s +1.1%
types_table_scan_postgres 5.48/s 5.39/s -1.7%

@github-actions
Copy link
Copy Markdown
Contributor

Main PR
Total 42090 42090
Successful 15738 15727
Failures 26352 26363
Partial Successes1 5189 5198
Main PR
Successful 37.3913% 37.3652%
Failures 62.6087% 62.6348%

${\color{red}Regressions (24)}$

identity

QUERY:          CREATE TABLE itest3 (a smallint generated by default as identity (start with 7 increment by 5), b text);
RECEIVED ERROR: sequence options are not yet supported, create a sequence separately
QUERY:          INSERT INTO itest2 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest2" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest2 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest2" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest3 DEFAULT VALUES;
RECEIVED ERROR: table not found: itest3 (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO itest3 DEFAULT VALUES;
RECEIVED ERROR: table not found: itest3 (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO itest5 VALUES (DEFAULT, 'a');
RECEIVED ERROR: The value specified for generated column "a" in table "itest5" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest5 VALUES (DEFAULT, 'b'), (DEFAULT, 'c');
RECEIVED ERROR: The value specified for generated column "a" in table "itest5" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest3 VALUES (DEFAULT, 'a');
RECEIVED ERROR: table not found: itest3 (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO itest3 VALUES (DEFAULT, 'b'), (DEFAULT, 'c');
RECEIVED ERROR: table not found: itest3 (errno 1146) (sqlstate HY000)
QUERY:          COPY itest9 FROM stdin;
RECEIVED ERROR: The value specified for generated column "a" in table "itest9" is not allowed.
QUERY:          ALTER TABLE itest3 ALTER COLUMN a TYPE int;
RECEIVED ERROR: table not found: itest3 (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO itest6 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest6" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest6 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest6" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest6 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest6" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest7 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest7" is not allowed. (errno 1105) (sqlstate HY000)
QUERY:          INSERT INTO itest8 DEFAULT VALUES;
RECEIVED ERROR: The value specified for generated column "a" in table "itest8" is not allowed. (errno 1105) (sqlstate HY000)

truncate

QUERY:          CREATE TABLE truncate_b (id int GENERATED ALWAYS AS IDENTITY (START WITH 44));
RECEIVED ERROR: sequence options are not yet supported, create a sequence separately
QUERY:          INSERT INTO truncate_b DEFAULT VALUES;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO truncate_b DEFAULT VALUES;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)
QUERY:          TRUNCATE truncate_b;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO truncate_b DEFAULT VALUES;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO truncate_b DEFAULT VALUES;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO truncate_b DEFAULT VALUES;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)
QUERY:          INSERT INTO truncate_b DEFAULT VALUES;
RECEIVED ERROR: table not found: truncate_b (errno 1146) (sqlstate HY000)

${\color{lightgreen}Progressions (13)}$

create_table_like

QUERY: SELECT * FROM test_like_id_1;

identity

QUERY: SELECT pg_get_serial_sequence('itest1', 'a');
QUERY: CREATE TABLE itest_err_1 (a text generated by default as identity);
QUERY: CREATE TABLE itest_err_3 (a int default 5 generated by default as identity);
QUERY: SELECT * FROM itest1;
QUERY: INSERT INTO itest5 VALUES (1, 'a');
QUERY: INSERT INTO itest5 VALUES (2, 'b'), (3, 'c');
QUERY: INSERT INTO itest5 VALUES (DEFAULT, 'b'), (3, 'c');
QUERY: INSERT INTO itest5 VALUES (2, 'b'), (DEFAULT, 'c');
QUERY: INSERT INTO itest2 VALUES (10, 'xyz');
QUERY: UPDATE itest1 SET a = DEFAULT WHERE a = 2;
QUERY: UPDATE itest2 SET a = 101 WHERE a = 1;
QUERY: ALTER TABLE itest3 ALTER COLUMN a TYPE text;

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

Copy link
Copy Markdown
Collaborator

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zachmu zachmu merged commit 0a9e525 into main Mar 26, 2025
14 checks passed
@zachmu zachmu deleted the zachmu/serial-id branch March 26, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Django uses PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY in create table which parse but does not generate a default

2 participants