pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@postgresql.org
Subject: pgsql: Use MINVALUE/MAXVALUE instead of UNBOUNDED for range partition b
Date: Fri, 21 Jul 2017 08:24:37 +0000
Message-ID: <E1dYTEj-000321-Cc@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Use MINVALUE/MAXVALUE instead of UNBOUNDED for range partition bounds.

Previously, UNBOUNDED meant no lower bound when used in the FROM list,
and no upper bound when used in the TO list, which was OK for
single-column range partitioning, but problematic with multiple
columns. For example, an upper bound of (10.0, UNBOUNDED) would not be
collocated with a lower bound of (10.0, UNBOUNDED), thus making it
difficult or impossible to define contiguous multi-column range
partitions in some cases.

Fix this by using MINVALUE and MAXVALUE instead of UNBOUNDED to
represent a partition column that is unbounded below or above
respectively. This syntax removes any ambiguity, and ensures that if
one partition's lower bound equals another partition's upper bound,
then the partitions are contiguous.

Also drop the constraint prohibiting finite values after an unbounded
column, and just document the fact that any values after MINVALUE or
MAXVALUE are ignored. Previously it was necessary to repeat UNBOUNDED
multiple times, which was needlessly verbose.

Note: Forces a post-PG 10 beta2 initdb.

Report by Amul Sul, original patch by Amit Langote with some
additional hacking by me.

Discussion: https://postgr.es/m/CAAJ_b947mowpLdxL3jo3YLKngRjrq9+Ej4ymduQTfYR+8=YAYQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d363d42bb9a4399a0207bd3b371c966e22e06bd3

Modified Files
--------------
doc/src/sgml/ref/create_table.sgml         |  61 +++++++--
src/backend/catalog/partition.c            | 211 ++++++++++++++---------------
src/backend/nodes/copyfuncs.c              |   2 +-
src/backend/nodes/equalfuncs.c             |   2 +-
src/backend/nodes/outfuncs.c               |   2 +-
src/backend/nodes/readfuncs.c              |   2 +-
src/backend/parser/gram.y                  |  16 ++-
src/backend/parser/parse_utilcmd.c         |  34 -----
src/backend/utils/adt/ruleutils.c          |  12 +-
src/include/catalog/catversion.h           |   2 +-
src/include/nodes/parsenodes.h             |  16 ++-
src/test/regress/expected/create_table.out |  41 +++---
src/test/regress/expected/inherit.out      |   6 +-
src/test/regress/expected/insert.out       | 130 +++++++++++++++++-
src/test/regress/sql/create_table.sql      |  31 ++---
src/test/regress/sql/inherit.sql           |   6 +-
src/test/regress/sql/insert.sql            |  39 +++++-
src/tools/pgindent/typedefs.list           |   1 +
18 files changed, 377 insertions(+), 237 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (25+ messages)  latest in thread

Message-ID: <E1dYTEj-000321-Cc@gemulon.postgresql.org>
Permalink:  ../E1dYTEj-000321-Cc@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dYTEj-000321-Cc@gemulon.postgresql.org

 · 

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: dean.a.rasheed@gmail.com
  Subject: Re: pgsql: Use MINVALUE/MAXVALUE instead of UNBOUNDED for range partition b
  In-Reply-To: <E1dYTEj-000321-Cc@gemulon.postgresql.org>
  References: <E1dYTEj-000321-Cc@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