Skip to content

Commit

Permalink
Deparser: Ensure index names are quoted as identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
lfittl committed Feb 26, 2023
1 parent fc5775e commit b66f9ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pg_query_deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -7938,7 +7938,7 @@ static void deparseIndexStmt(StringInfo str, IndexStmt *index_stmt)

if (index_stmt->idxname != NULL)
{
appendStringInfoString(str, index_stmt->idxname);
appendStringInfoString(str, quote_identifier(index_stmt->idxname));
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 @@ -387,6 +387,7 @@ const char* tests[] = {
"ALTER TABLE ALL IN TABLESPACE foo OWNED BY bar, quux SET TABLESPACE fred NOWAIT",
"MERGE INTO measurement m USING new_measurement nm ON m.city_id = nm.city_id AND m.logdate = nm.logdate WHEN MATCHED AND nm.peaktemp IS NULL THEN DELETE WHEN MATCHED THEN UPDATE SET peaktemp = GREATEST(m.peaktemp, nm.peaktemp), unitsales = m.unitsales + COALESCE(nm.unitsales, 0) WHEN NOT MATCHED THEN INSERT (city_id, logdate, peaktemp, unitsales) VALUES (city_id, logdate, peaktemp, unitsales)",
"COPY vistest FROM STDIN FREEZE CSV",
"CREATE INDEX \"foo.index\" ON foo USING btree (bar)",
};

size_t testsLength = __LINE__ - 4;

0 comments on commit b66f9ef

Please sign in to comment.