Обсуждение: [COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

Поиск
Список
Период
Сортировка

[COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

От
Robert Haas
Дата:
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

Re: [COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

От
Tom Lane
Дата:
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

Re: [COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

От
Thomas Munro
Дата:
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);   /*
Therecan never be a whole-row reference here */   if (found_whole_row)       elog(ERROR, "unexpected whole-row
referencefound 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

Re: [COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

От
Thomas Munro
Дата:
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

Re: [COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

От
Tom Lane
Дата:
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

Re: [COMMITTERS] pgsql: Allow a partitioned table to have a default partition.

От
Robert Haas
Дата:
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