pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allow a partitioned table to have a default partition.
6+ messages / 4 participants
[nested] [flat]

* pgsql: Allow a partitioned table to have a default partition.
@ 2017-09-08 21:35  Robert Haas <rhaas@postgresql.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Robert Haas @ 2017-09-08 21:35 UTC (permalink / raw)
  To: pgsql-committers

Allow a partitioned table to have a default partition.

Any tuples that don't route to any other partition will route to the
default partition.

Jeevan Ladhe, Beena Emerson, Ashutosh Bapat, Rahila Syed, and Robert
Haas, with review and testing at various stages by (at least) Rushabh
Lathia, Keith Fiske, Amit Langote, Amul Sul, Rajkumar Raghuanshi, Sven
Kunze, Kyotaro Horiguchi, Thom Brown, Rafia Sabih, and Dilip Kumar.

Discussion: http://postgr.es/m/CAH2L28tbN4SYyhS7YV1YBWcitkqbhSWfQCy0G=apRcC_PEO-bg@mail.gmail.com
Discussion: http://postgr.es/m/CAOG9ApEYj34fWMcvBMBQ-YtqR9fTdXhdN82QEKG0SVZ6zeL1xg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6f6b99d1335be8ea1b74581fc489a97b109dd08a

Modified Files
--------------
doc/src/sgml/catalogs.sgml                 |  11 +
doc/src/sgml/ref/alter_table.sgml          |  31 +-
doc/src/sgml/ref/create_table.sgml         |  35 +-
src/backend/catalog/heap.c                 |  41 +-
src/backend/catalog/partition.c            | 644 ++++++++++++++++++++++++++---
src/backend/commands/tablecmds.c           | 187 +++++++--
src/backend/nodes/copyfuncs.c              |   1 +
src/backend/nodes/equalfuncs.c             |   1 +
src/backend/nodes/outfuncs.c               |   1 +
src/backend/nodes/readfuncs.c              |   1 +
src/backend/parser/gram.y                  |  27 +-
src/backend/parser/parse_utilcmd.c         |  12 +
src/backend/utils/adt/ruleutils.c          |   8 +-
src/bin/psql/describe.c                    |  11 +-
src/bin/psql/tab-complete.c                |   4 +-
src/include/catalog/catversion.h           |   2 +-
src/include/catalog/partition.h            |   7 +
src/include/catalog/pg_partitioned_table.h |  13 +-
src/include/commands/tablecmds.h           |   4 +
src/include/nodes/parsenodes.h             |   1 +
src/test/regress/expected/alter_table.out  |  49 +++
src/test/regress/expected/create_table.out |  20 +
src/test/regress/expected/insert.out       | 147 ++++++-
src/test/regress/expected/plancache.out    |  26 ++
src/test/regress/expected/sanity_check.out |   4 +
src/test/regress/expected/update.out       |  33 ++
src/test/regress/sql/alter_table.sql       |  47 +++
src/test/regress/sql/create_table.sql      |  20 +
src/test/regress/sql/insert.sql            |  69 +++-
src/test/regress/sql/plancache.sql         |  21 +
src/test/regress/sql/update.sql            |  24 ++
31 files changed, 1367 insertions(+), 135 deletions(-)


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


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Allow a partitioned table to have a default partition.
@ 2017-09-08 21:49  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Robert Haas <rhaas@postgresql.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2017-09-08 21:49 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; +Cc: pgsql-committers

Robert Haas <rhaas@postgresql.org> writes:
> Allow a partitioned table to have a default partition.

Early buildfarm returns not good.

It passes here, so the problem isn't obvious.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Allow a partitioned table to have a default partition.
@ 2017-09-08 22:23  Thomas Munro <thomas.munro@enterprisedb.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Thomas Munro @ 2017-09-08 22:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <rhaas@postgresql.org>; pgsql-committers

On Sat, Sep 9, 2017 at 9:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <rhaas@postgresql.org> writes:
>> Allow a partitioned table to have a default partition.
>
> Early buildfarm returns not good.
>
> It passes here, so the problem isn't obvious.

map_partition_varattnos() doesn't always write to *found_whole_row, so
it's uninitialised here in generate_partition_qual():

    result = map_partition_varattnos(result, 1, rel, parent,
                                     &found_whole_row);
    /* There can never be a whole-row reference here */
    if (found_whole_row)
        elog(ERROR, "unexpected whole-row reference found in partition key");

-- 
Thomas Munro
http://www.enterprisedb.com


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Allow a partitioned table to have a default partition.
@ 2017-09-08 22:36  Thomas Munro <thomas.munro@enterprisedb.com>
  parent: Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Thomas Munro @ 2017-09-08 22:36 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <rhaas@postgresql.org>; pgsql-committers

On Sat, Sep 9, 2017 at 10:23 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Sat, Sep 9, 2017 at 9:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Robert Haas <rhaas@postgresql.org> writes:
>>> Allow a partitioned table to have a default partition.
>>
>> Early buildfarm returns not good.
>>
>> It passes here, so the problem isn't obvious.
>
> map_partition_varattnos() doesn't always write to *found_whole_row, so
> it's uninitialised here in generate_partition_qual():
>
>     result = map_partition_varattnos(result, 1, rel, parent,
>                                      &found_whole_row);
>     /* There can never be a whole-row reference here */
>     if (found_whole_row)
>         elog(ERROR, "unexpected whole-row reference found in partition key");

Hmm, no.  I take that back.

-- 
Thomas Munro
http://www.enterprisedb.com


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Allow a partitioned table to have a default partition.
@ 2017-09-08 22:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2017-09-08 22:50 UTC (permalink / raw)
  To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Robert Haas <rhaas@postgresql.org>; pgsql-committers

Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Sat, Sep 9, 2017 at 10:23 AM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> map_partition_varattnos() doesn't always write to *found_whole_row, so
>> it's uninitialised here in generate_partition_qual():

That was the first thing I thought of ...

> Hmm, no.  I take that back.

... and I looked at map_variable_attnos and decided it was fine, too.

But it ain't.  It's failing on empty partition expressions, and there's
a short-circuit exit from map_partition_varattnos.

Will fix.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Allow a partitioned table to have a default partition.
@ 2017-09-09 00:08  Robert Haas <robertmhaas@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2017-09-09 00:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Thomas Munro <thomas.munro@enterprisedb.com>; pgsql-committers

On Fri, Sep 8, 2017 at 6:50 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> But it ain't.  It's failing on empty partition expressions, and there's
> a short-circuit exit from map_partition_varattnos.
>
> Will fix.

Thanks.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2017-09-09 00:08 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 21:35 pgsql: Allow a partitioned table to have a default partition. Robert Haas <rhaas@postgresql.org>
2017-09-08 21:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-09-08 22:23   ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-09-08 22:36     ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-09-08 22:50       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-09-09 00:08         ` Robert Haas <robertmhaas@gmail.com>

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