PostgreSQL auto-quote: the deliberate-exclusion guard covers 7 of the 17 excluded words
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 90/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- postgresql, typescript
Research direction
Start in packages/SQLDialect/src/postgresqlAutoQuote.test.ts at line 225 and compare the guard with the exclusion list in postgresqlAutoQuote.ts. Extend the test literal to include all seventeen excluded words plus USER, then run postgresqlAutoQuote.test.ts and postgresqlAutoQuote.baseline.test.ts. Done means every deliberate exclusion is covered by the guard.
Written by the indexing model from the issue text.
Description
What
packages/SQLDialect/src/postgresqlAutoQuote.ts deliberately excludes seventeen non-reserved PostgreSQL words from PostgreSQLQuotingKeywords, on the reasoning that each is a legal bare column name and a believable ALL-CAPS identifier in a customer schema:
LEVEL, MODE, OPTION, SHARE, START, CACHE, ROLE, PASSWORD, LOGIN,
DOMAIN, CLUSTER, POLICY, SEQUENCE, LOCAL, SKIP, EXCLUSIVE, SOURCE
A test pins the exclusion so it stays deliberate rather than becoming incidental — postgresqlAutoQuote.test.ts:225:
for (const word of ['USER', 'LEVEL', 'MODE', 'OPTION', 'SHARE', 'START', 'CACHE', 'POLICY']) {
// ... must stay quoted
}
That is USER plus 7 of the 17. The remaining ten — ROLE, PASSWORD, LOGIN, DOMAIN, CLUSTER, SEQUENCE, LOCAL, SKIP, EXCLUSIVE, SOURCE — appear zero times in either postgresqlAutoQuote.test.ts or postgresqlAutoQuote.baseline.test.ts.
Why it is worth closing
Nothing is broken today. None of the seventeen is in the keyword set, so all seventeen are quoted correctly with or without a test. This is purely about the guard, not about behavior.
The guard exists to stop a future change from sweeping one of these words into the keyword set. That is not hypothetical in the abstract: #4436 added roughly eighty words in a single pass, and a later pass of the same kind is exactly how one of the ten would slip in. If SEQUENCE were added, an ALL-CAPS SEQUENCE column in a customer schema would stop being quoted and would resolve as the keyword instead.
There is also a small irony worth recording: #4436's own thesis is that "sampling is precisely what let CURRENT_DATE through" — and this guard is sampled.
Fix
Extend the array at postgresqlAutoQuote.test.ts:225 to all seventeen words (plus USER). It is a one-line change to a literal; the assertion body already does the right thing.
Worth pulling the list from a single exported constant shared with the source comment, so the two cannot drift again.
Found during review of #4436 and deliberately not requested as a change on that PR — the PR is correct as written and this is a test-completeness follow-up.
- Dominant language
- TSQL
- Stars
- 29
- Forks
- 6
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 295
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MemberJunction/MJ
-
next-protect requires only one status check, so PRs merge red and break the branch for everyone Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MemberJunction/MJ#4609 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MemberJunction/MJ#4603 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MemberJunction/MJ#4570 ·
-
bug priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MemberJunction/MJ#4548 ·
-
bug priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
MemberJunction/MJ#4547 ·
All issues in MemberJunction/MJ
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenLiberty/open-liberty#35839 ·
-
affects-9.0 found-by-ai may-affects-25.10 may-affects-26.3 may-affects-26.9 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/execution type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
antlr/grammars-v4#5014 · 1 comment ·
-
comp-query-execution fuzz
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121303 · 3 comments ·