forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd5890f4
committed
Fix hstore hash function for empty hstores upgraded from 8.4.
Hstore data generated on pg 8.4 and pg_upgraded to current versionsremains in its original on-disk format unless modified. The same goesfor values generated by the addon hstore-new module on pre-9.0versions. (The hstoreUpgrade function converts old values on the flywhen read in, but the on-disk value is not modified by this.)Since old-format empty hstores (and hstore-new hstores) haverepresentations compatible with the new format, hstoreUpgrade thoughtit could get away without modifying such values; but this breakshstore_hash (and the new hstore_hash_extended) which assumesbit-perfect matching between semantically identical hstore values.Only one bit actually differs (the "new version" flag in the countfield) but that of course is enough to break the hash.Fix by making hstoreUpgrade unconditionally convert all old values tonew format.Backpatch all the way, even though this changes a hash value in somecases, because in those cases the hash value is already failing - forexample, a hash join between old- and new-format empty hstores will befailing to match, or a hash index on an hstore column containing anold-format empty value will be failing to find the value since it willbe searching for a hash derived from a new-format datum. (There are noknown field reports of this happening, probably because hashing ofhstores has only been useful in limited circumstances and thereprobably isn't much upgraded data being used this way.)Per concerns arising from discussion of commiteb6f291. Originalbug is my fault.Discussion:https://postgr.es/m/60b1fd3b-7332-40f0-7e7f-f2f04f777747%402ndquadrant.com1 parent757c518 commitd5890f4
1 file changed
+19
-28
lines changedLines changed: 19 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
238 | 238 |
| |
239 | 239 |
| |
240 | 240 |
| |
241 |
| - | |
242 | 241 |
| |
243 | 242 |
| |
244 |
| - | |
245 |
| - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
246 | 251 |
| |
| 252 | + | |
| 253 | + | |
| 254 | + | |
247 | 255 |
| |
| 256 | + | |
248 | 257 |
| |
249 | 258 |
| |
250 | 259 |
| |
251 |
| - | |
252 |
| - | |
253 | 260 |
| |
254 | 261 |
| |
255 | 262 |
| |
256 | 263 |
| |
257 | 264 |
| |
258 | 265 |
| |
259 |
| - | |
260 |
| - | |
261 |
| - | |
262 |
| - | |
| 266 | + | |
263 | 267 |
| |
264 |
| - | |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
| 268 | + | |
| 269 | + | |
269 | 270 |
| |
270 | 271 |
| |
271 | 272 |
| |
| |||
302 | 303 |
| |
303 | 304 |
| |
304 | 305 |
| |
305 |
| - | |
306 |
| - | |
307 |
| - | |
| 306 | + | |
308 | 307 |
| |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 |
| - | |
313 |
| - | |
| 308 | + | |
| 309 | + | |
314 | 310 |
| |
315 | 311 |
| |
316 | 312 |
| |
317 | 313 |
| |
318 | 314 |
| |
319 | 315 |
| |
320 | 316 |
| |
321 |
| - | |
322 |
| - | |
| 317 | + | |
323 | 318 |
| |
324 |
| - | |
325 |
| - | |
326 |
| - | |
327 |
| - | |
328 | 319 |
| |
329 | 320 |
| |
330 | 321 |
| |
|
0 commit comments
Comments
(0)