pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Multirange datatypes
Date: Sun, 20 Dec 2020 04:21:16 +0000
Message-ID: <E1kqqDc-0004FM-5a@gemulon.postgresql.org> (raw )
Multirange datatypes
Multiranges are basically sorted arrays of non-overlapping ranges with
set-theoretic operations defined over them.
Since v14, each range type automatically gets a corresponding multirange
datatype. There are both manual and automatic mechanisms for naming multirange
types. Once can specify multirange type name using multirange_type_name
attribute in CREATE TYPE. Otherwise, a multirange type name is generated
automatically. If the range type name contains "range" then we change that to
"multirange". Otherwise, we add "_multirange" to the end.
Implementation of multiranges comes with a space-efficient internal
representation format, which evades extra paddings and duplicated storage of
oids. Altogether this format allows fetching a particular range by its index
in O(n).
Statistic gathering and selectivity estimation are implemented for multiranges.
For this purpose, stored multirange is approximated as union range without gaps.
This field will likely need improvements in the future.
Catversion is bumped.
Discussion: https://postgr.es/m/CALNJ-vSUpQ_Y%3DjXvTxt1VYFztaBSsWVXeF1y6gTYQ4bOiWDLgQ%40mail.gmail.com
Discussion: https://postgr.es/m/a0b8026459d1e6167933be2104a6174e7d40d0ab.camel%40j-davis.com#fe7218c83b08068bfff...
Author: Paul Jungwirth, revised by me
Reviewed-by: David Fetter, Corey Huinker, Jeff Davis, Pavel Stehule
Reviewed-by: Alvaro Herrera, Tom Lane, Isaac Morland, David G. Johnston
Reviewed-by: Zhihong Yu, Alexander Korotkov
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6df7a9698bb036610c1e8c6d375e1be38cb26d5f
Modified Files
--------------
doc/src/sgml/catalogs.sgml | 15 +-
doc/src/sgml/datatype.sgml | 23 +
doc/src/sgml/extend.sgml | 59 +-
doc/src/sgml/func.sgml | 656 +++++-
doc/src/sgml/rangetypes.sgml | 67 +-
doc/src/sgml/ref/create_type.sgml | 21 +
src/backend/catalog/pg_range.c | 10 +-
src/backend/catalog/pg_type.c | 118 +-
src/backend/commands/typecmds.c | 357 ++-
src/backend/executor/functions.c | 3 +-
src/backend/parser/parse_coerce.c | 350 ++-
src/backend/utils/adt/Makefile | 2 +
src/backend/utils/adt/multirangetypes.c | 2679 ++++++++++++++++++++++
src/backend/utils/adt/multirangetypes_selfuncs.c | 1320 +++++++++++
src/backend/utils/adt/pg_upgrade_support.c | 22 +
src/backend/utils/adt/pseudotypes.c | 38 +
src/backend/utils/adt/rangetypes.c | 177 +-
src/backend/utils/adt/rangetypes_typanalyze.c | 78 +-
src/backend/utils/cache/lsyscache.c | 62 +-
src/backend/utils/cache/syscache.c | 12 +
src/backend/utils/cache/typcache.c | 98 +-
src/backend/utils/fmgr/funcapi.c | 180 +-
src/bin/pg_dump/pg_dump.c | 166 +-
src/bin/pg_dump/pg_dump.h | 1 +
src/bin/pg_dump/t/002_pg_dump.pl | 2 +
src/include/access/tupmacs.h | 4 +-
src/include/catalog/binary_upgrade.h | 2 +
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_aggregate.dat | 11 +
src/include/catalog/pg_amop.dat | 22 +
src/include/catalog/pg_amproc.dat | 12 +-
src/include/catalog/pg_cast.dat | 13 +
src/include/catalog/pg_opclass.dat | 4 +
src/include/catalog/pg_operator.dat | 169 ++
src/include/catalog/pg_opfamily.dat | 4 +
src/include/catalog/pg_proc.dat | 282 +++
src/include/catalog/pg_range.dat | 15 +-
src/include/catalog/pg_range.h | 9 +-
src/include/catalog/pg_type.dat | 45 +
src/include/catalog/pg_type.h | 10 +-
src/include/commands/typecmds.h | 2 +
src/include/utils/lsyscache.h | 3 +
src/include/utils/multirangetypes.h | 116 +
src/include/utils/rangetypes.h | 12 +
src/include/utils/selfuncs.h | 3 +
src/include/utils/syscache.h | 1 +
src/include/utils/typcache.h | 38 +-
src/pl/plpgsql/src/pl_comp.c | 6 +
src/test/regress/expected/dependency.out | 1 +
src/test/regress/expected/hash_func.out | 13 +
src/test/regress/expected/multirangetypes.out | 2466 ++++++++++++++++++++
src/test/regress/expected/opr_sanity.out | 32 +-
src/test/regress/expected/plpgsql.out | 4 +-
src/test/regress/expected/polymorphism.out | 125 +-
src/test/regress/expected/rangefuncs.out | 2 +-
src/test/regress/expected/rangetypes.out | 42 +-
src/test/regress/expected/sanity_check.out | 2 +
src/test/regress/expected/type_sanity.out | 46 +-
src/test/regress/parallel_schedule | 6 +-
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/hash_func.sql | 10 +
src/test/regress/sql/multirangetypes.sql | 677 ++++++
src/test/regress/sql/opr_sanity.sql | 24 +-
src/test/regress/sql/polymorphism.sql | 52 +
src/test/regress/sql/rangetypes.sql | 14 +
src/test/regress/sql/type_sanity.sql | 16 +-
src/tools/pgindent/typedefs.list | 4 +
67 files changed, 10568 insertions(+), 270 deletions(-)
view thread (19+ messages) latest in thread
Message-ID: <E1kqqDc-0004FM-5a@gemulon.postgresql.org>
Permalink: ../E1kqqDc-0004FM-5a@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1kqqDc-0004FM-5a@gemulon.postgresql.org
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: akorotkov@postgresql.org
Subject: Re: pgsql: Multirange datatypes
In-Reply-To: <E1kqqDc-0004FM-5a@gemulon.postgresql.org>
References: <E1kqqDc-0004FM-5a@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox