Commit 06a7c31
committed
Allow most keywords to be used as column labels without requiring AS.
Up to now, if you tried to omit "AS" before a column label in a SELECT
list, it would only work if the column label was an IDENT, that is not
any known keyword. This is rather unfriendly considering that we have
so many keywords and are constantly growing more. In the wake of commit
1ed6b89 it's possible to improve matters quite a bit.
We'd originally tried to make this work by having some of the existing
keyword categories be allowed without AS, but that didn't work too well,
because each category contains a few special cases that don't work
without AS. Instead, invent an entirely orthogonal keyword property
"can be bare column label", and mark all keywords that way for which
we don't get shift/reduce errors by doing so.
It turns out that of our 450 current keywords, all but 39 can be made
bare column labels, improving the situation by over 90%. This number
might move around a little depending on future grammar work, but it's
a pretty nice improvement.
Mark Dilger, based on work by myself and Robert Haas;
review by John Naylor
Discussion: https://postgr.es/m/[email protected]1 parent 0811f76 commit 06a7c31
File tree
14 files changed
+1055
-520
lines changed- doc/src/sgml
- src
- backend
- parser
- utils/adt
- common
- include
- catalog
- common
- parser
- interfaces/ecpg/preproc
14 files changed
+1055
-520
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22173 | 22173 | | |
22174 | 22174 | | |
22175 | 22175 | | |
22176 | | - | |
| 22176 | + | |
| 22177 | + | |
| 22178 | + | |
22177 | 22179 | | |
22178 | 22180 | | |
22179 | 22181 | | |
| |||
22183 | 22185 | | |
22184 | 22186 | | |
22185 | 22187 | | |
| 22188 | + | |
| 22189 | + | |
| 22190 | + | |
| 22191 | + | |
| 22192 | + | |
22186 | 22193 | | |
22187 | | - | |
| 22194 | + | |
| 22195 | + | |
| 22196 | + | |
22188 | 22197 | | |
22189 | 22198 | | |
22190 | 22199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
66 | | - | |
67 | | - | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1496 | 1496 | | |
1497 | 1497 | | |
1498 | 1498 | | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
1505 | 1508 | | |
1506 | | - | |
| 1509 | + | |
1507 | 1510 | | |
1508 | | - | |
| 1511 | + | |
1509 | 1512 | | |
1510 | | - | |
| 1513 | + | |
| 1514 | + | |
1511 | 1515 | | |
1512 | | - | |
1513 | | - | |
| 1516 | + | |
| 1517 | + | |
1514 | 1518 | | |
1515 | 1519 | | |
1516 | 1520 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
24 | 46 | | |
25 | 47 | | |
26 | 48 | | |
| |||
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| 58 | + | |
36 | 59 | | |
37 | 60 | | |
38 | 61 | | |
| 62 | + | |
39 | 63 | | |
40 | 64 | | |
41 | 65 | | |
| |||
51 | 75 | | |
52 | 76 | | |
53 | 77 | | |
54 | | - | |
| 78 | + | |
55 | 79 | | |
56 | 80 | | |
57 | 81 | | |
| |||
63 | 87 | | |
64 | 88 | | |
65 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
66 | 94 | | |
67 | 95 | | |
68 | 96 | | |
| |||
97 | 125 | | |
98 | 126 | | |
99 | 127 | | |
100 | | - | |
| 128 | + | |
| 129 | + | |
101 | 130 | | |
102 | 131 | | |
103 | 132 | | |
| |||
107 | 136 | | |
108 | 137 | | |
109 | 138 | | |
110 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
111 | 147 | | |
112 | 148 | | |
113 | 149 | | |
114 | 150 | | |
115 | 151 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 152 | + | |
| 153 | + | |
135 | 154 | | |
136 | 155 | | |
137 | 156 | | |
| |||
147 | 166 | | |
148 | 167 | | |
149 | 168 | | |
| 169 | + | |
150 | 170 | | |
151 | 171 | | |
152 | 172 | | |
| |||
160 | 180 | | |
161 | 181 | | |
162 | 182 | | |
163 | | - | |
| 183 | + | |
164 | 184 | | |
165 | 185 | | |
166 | 186 | | |
167 | 187 | | |
| 188 | + | |
168 | 189 | | |
169 | 190 | | |
170 | 191 | | |
| |||
197 | 218 | | |
198 | 219 | | |
199 | 220 | | |
200 | | - | |
| 221 | + | |
201 | 222 | | |
202 | 223 | | |
203 | 224 | | |
| |||
219 | 240 | | |
220 | 241 | | |
221 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
222 | 266 | | |
223 | 267 | | |
224 | 268 | | |
| |||
0 commit comments