Skip to content

Commit d5fd839

Browse files
committed
fix for #128
1 parent 25e5b91 commit d5fd839

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

__fixtures__/generated/generated.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21089,6 +21089,7 @@
2108921089
"misc/issues-3.sql": "CREATE TABLE new_style (\n id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,\n val1 TEXT NOT NULL,\n val2 TEXT NULL,\n CONSTRAINT uq_val1_val2_new UNIQUE NULLS NOT DISTINCT (val1, val2)\n)",
2109021090
"misc/issues-4.sql": "CREATE TABLE new_style (\n id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,\n val1 TEXT NOT NULL,\n val2 TEXT NULL\n)",
2109121091
"misc/issues-5.sql": "ALTER TABLE new_style ADD CONSTRAINT uq_val1_val2_new UNIQUE NULLS NOT DISTINCT (val1, val2)",
21092+
"misc/issues-6.sql": "INSERT INTO\n public.people (id, name, epithet, is_great, gender, type_id, date_of_birth, date_of_death, place_of_birth, place_of_death, biography, canonical_status_id, image_url, source_url)\nVALUES\n (1, 'Asterius', 'of Amasea', FALSE, 'M', 1, '0350-01-01', '0410-01-01', 'Cappadocia', 'Amasea', NULL, 1, NULL, NULL),\n (2, 'Ausonius', NULL, FALSE, 'M', 1, '0310-01-01', '0395-01-01', 'Burdigala', NULL, NULL, NULL, NULL, NULL)\nON CONFLICT DO NOTHING",
2109221093
"misc/inflection-1.sql": "CREATE SCHEMA inflection",
2109321094
"misc/inflection-2.sql": "GRANT USAGE ON SCHEMA inflection TO PUBLIC",
2109421095
"misc/inflection-3.sql": "ALTER DEFAULT PRIVILEGES IN SCHEMA inflection \n GRANT EXECUTE ON FUNCTIONS TO PUBLIC",

__fixtures__/kitchen-sink/misc/issues.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@ CREATE TABLE new_style (
1616
val1 TEXT NOT NULL,
1717
val2 TEXT NULL
1818
);
19-
ALTER TABLE new_style ADD CONSTRAINT uq_val1_val2_new UNIQUE NULLS NOT DISTINCT (val1, val2);
19+
ALTER TABLE new_style ADD CONSTRAINT uq_val1_val2_new UNIQUE NULLS NOT DISTINCT (val1, val2);
20+
21+
-- https://github.com/launchql/pgsql-parser/issues/128
22+
INSERT INTO
23+
public.people (id, name, epithet, is_great, gender, type_id, date_of_birth, date_of_death, place_of_birth, place_of_death, biography, canonical_status_id, image_url, source_url)
24+
VALUES
25+
(1, 'Asterius', 'of Amasea', FALSE, 'M', 1, '0350-01-01', '0410-01-01', 'Cappadocia', 'Amasea', NULL, 1, NULL, NULL),
26+
(2, 'Ausonius', NULL, FALSE, 'M', 1, '0310-01-01', '0395-01-01', 'Burdigala', NULL, NULL, NULL, NULL, NULL)
27+
ON CONFLICT DO NOTHING;

packages/deparser/__tests__/kitchen-sink/misc-issues.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ it('misc-issues', async () => {
88
"misc/issues-2.sql",
99
"misc/issues-3.sql",
1010
"misc/issues-4.sql",
11-
"misc/issues-5.sql"
11+
"misc/issues-5.sql",
12+
"misc/issues-6.sql"
1213
]);
1314
});

0 commit comments

Comments
 (0)