Commit ef51c09
committed
feat: add relaxed quoting for qualified name tails
PostgreSQL's grammar accepts all keyword categories (including RESERVED_KEYWORD)
in qualified name positions (after a dot). This change adds a new
quoteIdentifierQualifiedTail() method that only quotes for lexical reasons
(uppercase, special characters, leading digits) not for keyword reasons.
This allows the deparser to emit:
- faker.float instead of faker."float"
- myschema.select instead of myschema."select"
- t.from instead of t."from"
while still correctly quoting unqualified identifiers that are keywords.
Empirically verified with libpg-query that all keyword categories parse
successfully in qualified positions across DDL and DML contexts.1 parent 1923251 commit ef51c09
2 files changed
Lines changed: 62 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1317 | 1317 | | |
1318 | 1318 | | |
1319 | 1319 | | |
1320 | | - | |
| 1320 | + | |
1321 | 1321 | | |
1322 | 1322 | | |
1323 | 1323 | | |
| |||
1335 | 1335 | | |
1336 | 1336 | | |
1337 | 1337 | | |
1338 | | - | |
| 1338 | + | |
1339 | 1339 | | |
1340 | 1340 | | |
1341 | 1341 | | |
| |||
2018 | 2018 | | |
2019 | 2019 | | |
2020 | 2020 | | |
2021 | | - | |
| 2021 | + | |
2022 | 2022 | | |
2023 | | - | |
| 2023 | + | |
2024 | 2024 | | |
2025 | 2025 | | |
2026 | 2026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
107 | 160 | | |
108 | 161 | | |
109 | 162 | | |
| |||
112 | 165 | | |
113 | 166 | | |
114 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
115 | 172 | | |
116 | 173 | | |
117 | 174 | | |
118 | | - | |
| 175 | + | |
119 | 176 | | |
120 | 177 | | |
121 | 178 | | |
| |||
0 commit comments