Support for unnest(multirange) and cast multirange as an array of ranges

Enterprise / PostgreSQL - Alexander Korotkov [postgresql.org] - 15 June 2021 12:59 UTC

It has been spotted that multiranges lack of ability to decompose them into individual ranges. Subscription and proper expanded object representation require substantial work, and it's too late for v14. This commit provides the implementation of unnest(multirange) and cast multirange as an array of ranges, which is quite trivial.

unnest(multirange) is defined as a polymorphic procedure. The catalog description of the cast underlying procedure is duplicated for each multirange type because we don't have anyrangearray polymorphic type to use here.

Catversion is bumped.

29854ee8d1 Support for unnest(multirange) and cast multirange as an array of ranges
doc/src/sgml/func.sgml | 23 ++++++
doc/src/sgml/rangetypes.sgml | 12 +++
src/backend/commands/typecmds.c | 92 ++++++++++++++++++++--
src/backend/utils/adt/multirangetypes.c | 106 ++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_cast.dat | 20 +++++
src/include/catalog/pg_proc.dat | 23 ++++++
src/test/regress/expected/multirangetypes.out | 60 +++++++++++++++
src/test/regress/expected/opr_sanity.out | 6 ++
src/test/regress/sql/multirangetypes.sql | 13 ++++
src/test/regress/sql/opr_sanity.sql | 6 ++
11 files changed, 354 insertions(+), 9 deletions(-)

Upstream: git.postgresql.org


  • Share