postgresql/src/backend/utils/cache
Peter Eisentraut 94aa7cc5f7 Add UNIQUE null treatment option
The SQL standard has been ambiguous about whether null values in
unique constraints should be considered equal or not.  Different
implementations have different behaviors.  In the SQL:202x draft, this
has been formalized by making this implementation-defined and adding
an option on unique constraint definitions UNIQUE [ NULLS [NOT]
DISTINCT ] to choose a behavior explicitly.

This patch adds this option to PostgreSQL.  The default behavior
remains UNIQUE NULLS DISTINCT.  Making this happen in the btree code
is pretty easy; most of the patch is just to carry the flag around to
all the places that need it.

The CREATE UNIQUE INDEX syntax extension is not from the standard,
it's my own invention.

I named all the internal flags, catalog columns, etc. in the negative
("nulls not distinct") so that the default PostgreSQL behavior is the
default if the flag is false.

Reviewed-by: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/84e5ee1b-387e-9a54-c326-9082674bde78@enterprisedb.com
2022-02-03 11:48:21 +01:00
..
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
attoptcache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
catcache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
evtcache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
inval.c Remove xloginsert.h from xlog.h 2022-01-30 12:25:24 -03:00
lsyscache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
partcache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
plancache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
relcache.c Add UNIQUE null treatment option 2022-02-03 11:48:21 +01:00
relfilenodemap.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
relmapper.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
spccache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
syscache.c Add stxdinherit flag to pg_statistic_ext_data 2022-01-16 13:38:01 +01:00
ts_cache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
typcache.c Update copyright for 2022 2022-01-07 19:04:57 -05:00