- Notifications
You must be signed in to change notification settings - Fork28
Commitfb8697b
committed
Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers.
We have a lot of code in which option names, which from the user'sviewpoint are logically keywords, are passed through the grammar as plainidentifiers, and then matched to string literals during command execution.This approach avoids making words into lexer keywords unnecessarily. Someplaces matched these strings using plain strcmp, some using pg_strcasecmp.But the latter should be unnecessary since identifiers would have beendowncased on their way through the parser. Aside from any efficiencyconcerns (probably not a big factor), the lack of consistency in this areacreates a hazard of subtle bugs due to different places coming to differentconclusions about whether two option names are the same or different.Hence, standardize on using strcmp() to match any option names that areexpected to have been fed through the parser.This does create a user-visible behavioral change, which is that whileformerly all of these would work:alter table foo set (fillfactor = 50);alter table foo set (FillFactor = 50);alter table foo set ("fillfactor" = 50);alter table foo set ("FillFactor" = 50);now the last case will fail because that double-quoted identifier isdifferent from the others. However, none of our documentation says thatyou can use a quoted identifier in such contexts at all, and we shoulddiscourage doing so since it would break if we ever decide to parse suchconstructs as true lexer keywords rather than poor man's substitutes.So this shouldn't create a significant compatibility issue for users.Daniel Gustafsson, reviewed by Michael Paquier, small changes by meDiscussion:https://postgr.es/m/29405B24-564E-476B-98C0-677A29805B84@yesql.se1 parent9fd8b7d commitfb8697b
File tree
37 files changed
+318
-143
lines changed- contrib
- dict_int
- dict_xsyn
- unaccent
- doc/src/sgml
- src
- backend
- access/common
- commands
- parser
- snowball
- tsearch
- include/access
- test/regress
- expected
- sql
37 files changed
+318
-143
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
45 |
| - | |
| 45 | + | |
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
49 |
| - | |
| 49 | + | |
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
|
Lines changed: 5 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 |
| - | |
| 160 | + | |
161 | 161 |
| |
162 | 162 |
| |
163 | 163 |
| |
164 |
| - | |
| 164 | + | |
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
| 168 | + | |
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
172 |
| - | |
| 172 | + | |
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
176 |
| - | |
| 176 | + | |
177 | 177 |
| |
178 | 178 |
| |
179 | 179 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
276 | 276 |
| |
277 | 277 |
| |
278 | 278 |
| |
279 |
| - | |
| 279 | + | |
280 | 280 |
| |
281 | 281 |
| |
282 | 282 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1271 | 1271 |
| |
1272 | 1272 |
| |
1273 | 1273 |
| |
| 1274 | + | |
1274 | 1275 |
| |
1275 | 1276 |
| |
1276 | 1277 |
| |
|
Lines changed: 10 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
796 | 796 |
| |
797 | 797 |
| |
798 | 798 |
| |
799 |
| - | |
| 799 | + | |
800 | 800 |
| |
801 | 801 |
| |
802 | 802 |
| |
803 | 803 |
| |
804 |
| - | |
| 804 | + | |
805 | 805 |
| |
806 | 806 |
| |
807 | 807 |
| |
| |||
849 | 849 |
| |
850 | 850 |
| |
851 | 851 |
| |
852 |
| - | |
853 |
| - | |
| 852 | + | |
854 | 853 |
| |
855 | 854 |
| |
856 | 855 |
| |
| |||
865 | 864 |
| |
866 | 865 |
| |
867 | 866 |
| |
868 |
| - | |
| 867 | + | |
869 | 868 |
| |
870 | 869 |
| |
871 | 870 |
| |
| |||
876 | 875 |
| |
877 | 876 |
| |
878 | 877 |
| |
879 |
| - | |
| 878 | + | |
880 | 879 |
| |
881 | 880 |
| |
882 | 881 |
| |
| |||
1082 | 1081 |
| |
1083 | 1082 |
| |
1084 | 1083 |
| |
1085 |
| - | |
1086 |
| - | |
| 1084 | + | |
1087 | 1085 |
| |
1088 | 1086 |
| |
1089 | 1087 |
| |
| |||
1262 | 1260 |
| |
1263 | 1261 |
| |
1264 | 1262 |
| |
1265 |
| - | |
| 1263 | + | |
1266 | 1264 |
| |
1267 | 1265 |
| |
1268 | 1266 |
| |
| |||
1556 | 1554 |
| |
1557 | 1555 |
| |
1558 | 1556 |
| |
1559 |
| - | |
1560 |
| - | |
1561 |
| - | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1562 | 1560 |
| |
1563 | 1561 |
| |
1564 | 1562 |
| |
|
Lines changed: 28 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
127 | 127 |
| |
128 | 128 |
| |
129 | 129 |
| |
130 |
| - | |
| 130 | + | |
131 | 131 |
| |
132 |
| - | |
| 132 | + | |
133 | 133 |
| |
134 |
| - | |
| 134 | + | |
135 | 135 |
| |
136 |
| - | |
| 136 | + | |
137 | 137 |
| |
138 |
| - | |
| 138 | + | |
139 | 139 |
| |
140 |
| - | |
| 140 | + | |
141 | 141 |
| |
142 |
| - | |
| 142 | + | |
143 | 143 |
| |
144 |
| - | |
| 144 | + | |
145 | 145 |
| |
146 |
| - | |
| 146 | + | |
147 | 147 |
| |
148 |
| - | |
| 148 | + | |
149 | 149 |
| |
150 |
| - | |
| 150 | + | |
151 | 151 |
| |
152 |
| - | |
| 152 | + | |
153 | 153 |
| |
154 |
| - | |
| 154 | + | |
155 | 155 |
| |
156 |
| - | |
| 156 | + | |
157 | 157 |
| |
158 |
| - | |
| 158 | + | |
159 | 159 |
| |
160 |
| - | |
| 160 | + | |
161 | 161 |
| |
162 | 162 |
| |
163 | 163 |
| |
| |||
168 | 168 |
| |
169 | 169 |
| |
170 | 170 |
| |
171 |
| - | |
| 171 | + | |
172 | 172 |
| |
173 |
| - | |
| 173 | + | |
174 | 174 |
| |
175 |
| - | |
| 175 | + | |
176 | 176 |
| |
177 |
| - | |
| 177 | + | |
178 | 178 |
| |
179 |
| - | |
| 179 | + | |
180 | 180 |
| |
181 |
| - | |
| 181 | + | |
182 | 182 |
| |
183 |
| - | |
| 183 | + | |
184 | 184 |
| |
185 |
| - | |
| 185 | + | |
186 | 186 |
| |
187 |
| - | |
| 187 | + | |
188 | 188 |
| |
189 | 189 |
| |
190 | 190 |
| |
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
423 |
| - | |
| 423 | + | |
424 | 424 |
| |
425 |
| - | |
| 425 | + | |
426 | 426 |
| |
427 |
| - | |
| 427 | + | |
428 | 428 |
| |
429 | 429 |
| |
430 | 430 |
| |
|
Lines changed: 6 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
85 |
| - | |
| 85 | + | |
86 | 86 |
| |
87 |
| - | |
| 87 | + | |
88 | 88 |
| |
89 |
| - | |
| 89 | + | |
90 | 90 |
| |
91 |
| - | |
| 91 | + | |
92 | 92 |
| |
93 |
| - | |
| 93 | + | |
94 | 94 |
| |
95 |
| - | |
| 95 | + | |
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
|
Lines changed: 22 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
108 |
| - | |
| 108 | + | |
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
116 |
| - | |
| 116 | + | |
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
124 |
| - | |
| 124 | + | |
125 | 125 |
| |
126 |
| - | |
| 126 | + | |
127 | 127 |
| |
128 |
| - | |
| 128 | + | |
129 | 129 |
| |
130 |
| - | |
| 130 | + | |
131 | 131 |
| |
132 |
| - | |
| 132 | + | |
133 | 133 |
| |
134 |
| - | |
| 134 | + | |
135 | 135 |
| |
136 |
| - | |
| 136 | + | |
137 | 137 |
| |
138 | 138 |
| |
139 |
| - | |
| 139 | + | |
140 | 140 |
| |
141 |
| - | |
| 141 | + | |
142 | 142 |
| |
143 |
| - | |
| 143 | + | |
144 | 144 |
| |
145 |
| - | |
| 145 | + | |
146 | 146 |
| |
147 | 147 |
| |
148 | 148 |
| |
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
423 |
| - | |
| 423 | + | |
424 | 424 |
| |
425 | 425 |
| |
426 | 426 |
| |
427 | 427 |
| |
428 |
| - | |
| 428 | + | |
429 | 429 |
| |
430 | 430 |
| |
431 | 431 |
| |
| |||
435 | 435 |
| |
436 | 436 |
| |
437 | 437 |
| |
438 |
| - | |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
445 | 445 |
| |
446 | 446 |
| |
447 | 447 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10536 | 10536 |
| |
10537 | 10537 |
| |
10538 | 10538 |
| |
10539 |
| - | |
| 10539 | + | |
10540 | 10540 |
| |
10541 | 10541 |
| |
10542 | 10542 |
| |
|
0 commit comments
Comments
(0)