postgresql/src/backend
Heikki Linnakangas fd436bba01 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
2020-01-20 10:36:45 +02:00
..
access Fix crash in BRIN inclusion op functions, due to missing datum copy. 2020-01-20 10:36:45 +02:00
bootstrap In bootstrap mode, use default signal handling for SIGINT etc. 2019-05-14 10:22:28 -04:00
catalog Fix buggy logic in isTempNamespaceInUse() 2020-01-15 13:58:41 +09:00
commands Fix handling of generated columns in ALTER TABLE. 2020-01-08 09:42:53 -05:00
executor Repair more failures with SubPlans in multi-row VALUES lists. 2020-01-17 16:17:32 -05:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Don't rely on llvm::make_unique. 2019-08-25 14:46:29 +12:00
lib Fix more typos and inconsistencies in the tree 2019-06-17 16:13:16 +09:00
libpq Extensive code review for GSSAPI encryption mechanism. 2020-01-11 17:14:08 -05:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Prevent overly-aggressive collapsing of joins to RTE_RESULT relations. 2019-12-14 13:49:15 -05:00
optimizer Prevent overly-aggressive collapsing of joins to RTE_RESULT relations. 2019-12-14 13:49:15 -05:00
parser Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING DEFAULTS. 2019-09-25 17:30:42 -04:00
partitioning Remove extra parenthesis from comment. 2019-12-12 15:45:01 +09:00
po Translation updates 2019-11-11 10:53:15 +01:00
port Fix race condition in our Windows signal emulation. 2019-12-09 15:03:51 -05:00
postmaster Clean up properly error_context_stack in autovacuum worker on exception 2019-10-23 10:25:46 +09:00
regex Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
replication Set ReorderBufferTXN->final_lsn more eagerly 2020-01-17 18:00:39 -03:00
rewrite Make rewriter prevent auto-updates on views with conditional INSTEAD rules. 2020-01-14 09:51:28 +00:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Remove unnecessary clauses_attnums variable 2019-11-28 23:28:53 +01:00
storage Maintain valid md.c state when FileClose() fails. 2020-01-10 18:31:25 -08:00
tcop Stabilize NOTIFY behavior by transmitting notifies before ReadyForQuery. 2019-11-24 14:42:59 -05:00
tsearch Suppress warning from older compilers. 2019-11-03 16:10:38 -05:00
utils Add GUC checks for ssl_min_protocol_version and ssl_max_protocol_version 2020-01-18 12:32:55 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
nls.mk Translation updates 2019-09-29 23:57:17 +02:00