Skip to content

Commit

Permalink
Deparser: Correctly quote identifier in ALTER TABLE ... ADD CONSTRAIN…
Browse files Browse the repository at this point in the history
…T [x]
  • Loading branch information
lfittl committed Jun 13, 2023
1 parent ed0fd87 commit f1b475d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/postgres_deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4593,7 +4593,7 @@ static void deparseConstraint(StringInfo str, Constraint *constraint)
if (constraint->conname != NULL)
{
appendStringInfoString(str, "CONSTRAINT ");
appendStringInfoString(str, constraint->conname);
appendStringInfoString(str, quote_identifier(constraint->conname));
appendStringInfoChar(str, ' ');
}

Expand Down
1 change: 1 addition & 0 deletions test/deparse_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ const char* tests[] = {
"CREATE INDEX \"foo.index\" ON foo USING btree (bar)",
"CREATE TABLE distributors (did int, name varchar(40), UNIQUE (name) WITH (fillfactor=70)) WITH (fillfactor=70)",
"SHOW ALL",
"ALTER TABLE ONLY public.\"Test 123\" ADD CONSTRAINT \"Test 123_pkey\" PRIMARY KEY (c1)",
};

size_t testsLength = __LINE__ - 4;

0 comments on commit f1b475d

Please sign in to comment.