Skip to content

Comments

Allow type keywords as unquoted index column names#1104

Merged
gfx merged 1 commit intosqldef:masterfrom
moznion:allow_type_name_in_index
Jan 8, 2026
Merged

Allow type keywords as unquoted index column names#1104
gfx merged 1 commit intosqldef:masterfrom
moznion:allow_type_name_in_index

Conversation

@moznion
Copy link
Contributor

@moznion moznion commented Jan 8, 2026

PostgreSQL's pg_get_constraintdef() returns column names like uuid without quotes. The generic parser was failing to parse these because type keywords (uuid, int, bigint, json, etc.) defined in type_func_name_keyword were not recognized as valid column names in index definitions.

Add type_func_name_keyword as an alternative in the index_column rule for basic, COLLATE, and operator_class patterns. This allows statements like UNIQUE (uuid) to parse successfully without requiring quotes.

PostgreSQL's pg_get_constraintdef() returns column names like `uuid`
without quotes. The generic parser was failing to parse these because
type keywords (uuid, int, bigint, json, etc.) defined in
type_func_name_keyword were not recognized as valid column names in
index definitions.

Add type_func_name_keyword as an alternative in the index_column rule
for basic, COLLATE, and operator_class patterns. This allows statements
like `UNIQUE (uuid)` to parse successfully without requiring quotes.

Signed-off-by: moznion <[email protected]>
@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gfx
Copy link
Contributor

gfx commented Jan 8, 2026

Yeah, keywords tend to cause similar issues everywhere, every time.

Thank you!

@gfx gfx added this pull request to the merge queue Jan 8, 2026
Merged via the queue into sqldef:master with commit 25b376d Jan 8, 2026
25 checks passed
@sqldef-bot sqldef-bot bot mentioned this pull request Jan 8, 2026
@moznion moznion deleted the allow_type_name_in_index branch January 8, 2026 23:40
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.

2 participants