- Notifications
You must be signed in to change notification settings - Fork5k
Commitf31aad9
committed
Fix query jumbling to account for NULL nodes
Previously NULL nodes were ignored. This could cause issues where thecomputed query ID could match for queries where fields that are next toeach other in their Node struct where one field was NULL and the othernon-NULL. For example, the Query struct had distinctClause and sortClausenext to each other. If someone wrote;SELECT DISTINCT c1 FROM t;and then;SELECT c1 FROM t ORDER BY c1;these would produce the same query ID since, in the first query, weignored the NULL sortClause and appended the jumble bytes for thedistictClause. In the latter query, since we did nothing for the NULLdistinctClause then jumble the non-NULL sortClause, and since the noderepresentation stored is the same in both cases, the query IDs wereidentical.Here we fix this by always accounting for NULL nodes by recording thatwe saw a NULL in the jumble buffer. This fixes the issue as the order thatthe NULL is recorded isn't the same in the above two queries.Author: Bykov Ivan <i.bykov@modernsys.ru>Author: Michael Paquier <michael@paquier.xyz>Author: David Rowley <dgrowleyml@gmail.com>Discussion:https://postgr.es/m/aafce7966e234372b2ba876c0193f1e9%40localhost.localdomain1 parent44fe6ce commitf31aad9
File tree
4 files changed
+238
-21
lines changed- contrib/pg_stat_statements
- expected
- sql
- src
- backend/nodes
- include/nodes
4 files changed
+238
-21
lines changedLines changed: 86 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
22 | 102 |
| |
23 | 103 |
| |
24 | 104 |
| |
| |||
135 | 215 |
| |
136 | 216 |
| |
137 | 217 |
| |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
138 | 222 |
| |
139 | 223 |
| |
140 | 224 |
| |
| 225 | + | |
141 | 226 |
| |
142 | 227 |
| |
143 | 228 |
| |
144 | 229 |
| |
145 | 230 |
| |
146 | 231 |
| |
147 | 232 |
| |
148 |
| - | |
| 233 | + | |
149 | 234 |
| |
150 | 235 |
| |
151 | 236 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
15 | 35 |
| |
16 | 36 |
| |
17 | 37 |
| |
|
Lines changed: 120 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
61 | 63 |
| |
62 | 64 |
| |
| 65 | + | |
63 | 66 |
| |
64 | 67 |
| |
65 | 68 |
| |
| |||
120 | 123 |
| |
121 | 124 |
| |
122 | 125 |
| |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
123 | 132 |
| |
124 | 133 |
| |
125 | 134 |
| |
126 |
| - | |
| 135 | + | |
127 | 136 |
| |
128 | 137 |
| |
129 | 138 |
| |
130 |
| - | |
| 139 | + | |
131 | 140 |
| |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
144 |
| - | |
145 |
| - | |
| 141 | + | |
146 | 142 |
| |
147 | 143 |
| |
148 | 144 |
| |
| |||
173 | 169 |
| |
174 | 170 |
| |
175 | 171 |
| |
176 |
| - | |
177 |
| - | |
| 172 | + | |
| 173 | + | |
178 | 174 |
| |
179 |
| - | |
180 |
| - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
181 | 225 |
| |
182 | 226 |
| |
183 | 227 |
| |
| |||
205 | 249 |
| |
206 | 250 |
| |
207 | 251 |
| |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
208 | 256 |
| |
| 257 | + | |
209 | 258 |
| |
210 | 259 |
| |
211 | 260 |
| |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
212 | 301 |
| |
213 | 302 |
| |
214 | 303 |
| |
| |||
335 | 424 |
| |
336 | 425 |
| |
337 | 426 |
| |
| 427 | + | |
| 428 | + | |
338 | 429 |
| |
339 | 430 |
| |
340 | 431 |
| |
| |||
385 | 476 |
| |
386 | 477 |
| |
387 | 478 |
| |
| 479 | + | |
| 480 | + | |
| 481 | + | |
388 | 482 |
| |
389 | 483 |
| |
| 484 | + | |
| 485 | + | |
390 | 486 |
| |
| 487 | + | |
391 | 488 |
| |
392 | 489 |
| |
393 | 490 |
| |
| |||
435 | 532 |
| |
436 | 533 |
| |
437 | 534 |
| |
| 535 | + | |
| 536 | + | |
| 537 | + | |
438 | 538 |
| |
439 | 539 |
| |
440 | 540 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
54 | 54 |
| |
55 | 55 |
| |
56 | 56 |
| |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
57 | 69 |
| |
58 | 70 |
| |
59 | 71 |
| |
|
0 commit comments
Comments
(0)