Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deparser: Ensure index names are quoted as identifiers #182

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;