aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2020-01-20 10:36:35 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2020-01-20 10:36:35 +0200
commit4c87010981f3a9a41751e5550f6eb889ab5667e8 (patch)
tree450a6809c39b96a5523f7b2e124c9b756e5a61cd /src/backend/utils/adt/jsonfuncs.c
parent40d964ec997f64227bc0ff5e058dc4a5770a70a9 (diff)
downloadpostgresql-4c87010981f3a9a41751e5550f6eb889ab5667e8.tar.gz
postgresql-4c87010981f3a9a41751e5550f6eb889ab5667e8.zip
Fix crash in BRIN inclusion op functions, due to missing datum copy.
The BRIN add_value() and union() functions need to make a longer-lived copy of the argument, if they want to store it in the BrinValues struct also passed as argument. The functions for the "inclusion operator classes" used with box, range and inet types didn't take into account that the union helper function might return its argument as is, without making a copy. Check for that case, and make a copy if necessary. That case arises at least with the range_union() function, when one of the arguments 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.fi Reviewed-by: Emre Hasegeli, Tom Lane, Alvaro Herrera
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
0 files changed, 0 insertions, 0 deletions