forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4c87010
committed
Fix crash in BRIN inclusion op functions, due to missing datum copy.
The BRIN add_value() and union() functions need to make a longer-livedcopy of the argument, if they want to store it in the BrinValues structalso passed as argument. The functions for the "inclusion operatorclasses" used with box, range and inet types didn't take into accountthat the union helper function might return its argument as is, withoutmaking a copy. Check for that case, and make a copy if necessary. Thatcase arises at least with the range_union() function, when one of thearguments is an 'empty' range:CREATE TABLE brintest (n numrange);CREATE INDEX brinidx ON brintest USING brin (n);INSERT INTO brintest VALUES ('empty');INSERT INTO brintest VALUES (numrange(0, 2^1000::numeric));INSERT INTO brintest VALUES ('(-1, 0)');SELECT brin_desummarize_range('brinidx', 0);SELECT brin_summarize_range('brinidx', 0);Backpatch down to 9.5, where BRIN was introduced.Discussion:https://www.postgresql.org/message-id/e6e1d6eb-0a67-36aa-e779-bcca59167c14%40iki.fiReviewed-by: Emre Hasegeli, Tom Lane, Alvaro Herrera1 parent40d964e commit4c87010
1 file changed
+14
-2
lines changedLines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
235 | 235 |
| |
236 | 236 |
| |
237 | 237 |
| |
238 |
| - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
239 | 241 |
| |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
240 | 246 |
| |
241 | 247 |
| |
242 | 248 |
| |
| |||
574 | 580 |
| |
575 | 581 |
| |
576 | 582 |
| |
577 |
| - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
578 | 586 |
| |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
579 | 591 |
| |
580 | 592 |
| |
581 | 593 |
| |
|
0 commit comments
Comments
(0)