pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Foreign keys on partitioned tables
4+ messages / 2 participants
[nested] [flat]

* pgsql: Foreign keys on partitioned tables
@ 2018-04-04 17:03  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2018-04-04 17:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Foreign keys on partitioned tables

Author: Álvaro Herrera
Discussion: https://postgr.es/m/20171231194359.cvojcour423ulha4@alvherre.pgsql
Reviewed-by: Peter Eisentraut

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3de241dba86f3dd000434f70aebba725fb928032

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml          |   3 +-
doc/src/sgml/ref/create_table.sgml         |  13 +-
src/backend/catalog/pg_constraint.c        | 237 +++++++++++++++++++++++++++++
src/backend/commands/tablecmds.c           | 193 ++++++++++++++++++-----
src/backend/parser/parse_utilcmd.c         |  12 --
src/backend/utils/adt/ri_triggers.c        |  59 ++++---
src/bin/pg_dump/pg_dump.c                  |  42 +++--
src/include/catalog/pg_constraint_fn.h     |  16 ++
src/include/commands/tablecmds.h           |   4 +
src/test/regress/expected/alter_table.out  |   4 -
src/test/regress/expected/create_table.out |  10 --
src/test/regress/expected/foreign_key.out  | 211 +++++++++++++++++++++++++
src/test/regress/expected/inherit.out      |  25 +++
src/test/regress/sql/alter_table.sql       |   1 -
src/test/regress/sql/create_table.sql      |   8 -
src/test/regress/sql/foreign_key.sql       | 154 +++++++++++++++++++
src/test/regress/sql/inherit.sql           |  12 ++
17 files changed, 895 insertions(+), 109 deletions(-)



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

* Re: pgsql: Foreign keys on partitioned tables
@ 2018-04-06 14:13  Robert Haas <robertmhaas@gmail.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Robert Haas @ 2018-04-06 14:13 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Wed, Apr 4, 2018 at 1:03 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Foreign keys on partitioned tables
>
> Author: Álvaro Herrera
> Discussion: https://postgr.es/m/20171231194359.cvojcour423ulha4@alvherre.pgsql
> Reviewed-by: Peter Eisentraut

The commit message here was so brief that I had to read the
documentation to figure out exactly what this feature was.  In so
doing, I ran across this, which seems to need some cleanup:

+      Also, while it's possible to define <literal>PRIMARY KEY</literal>
+      constraints on partitioned tables, it is not supported to create foreign
+      keys cannot that reference them.  This restriction will be lifted in a
+      future release.

Generally, I think we're better off not committing to doing things in
a future release because we never really know what will happen in the
future, but the biggest problem here is that "it is not supported to
create foreign keys cannot that reference them" doesn't make any
sense.  I think you mean something like "creating foreign keys that
reference a partitioned table is not supported".

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




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

* Re: pgsql: Foreign keys on partitioned tables
@ 2018-04-06 20:49  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2018-04-06 20:49 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Robert Haas wrote:
> On Wed, Apr 4, 2018 at 1:03 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > Foreign keys on partitioned tables
> >
> > Author: Álvaro Herrera
> > Discussion: https://postgr.es/m/20171231194359.cvojcour423ulha4@alvherre.pgsql
> > Reviewed-by: Peter Eisentraut
> 
> The commit message here was so brief that I had to read the
> documentation to figure out exactly what this feature was.

I wrote three draft commit messages, and they all seemed to be saying
something so obvious (just repeating the commit title) that I decided
not to repeat myself.  Evidently that was a mistake.

> In so doing, I ran across this, which seems to need some cleanup:
> 
> +      Also, while it's possible to define <literal>PRIMARY KEY</literal>
> +      constraints on partitioned tables, it is not supported to create foreign
> +      keys cannot that reference them.  This restriction will be lifted in a
> +      future release.
> 
> Generally, I think we're better off not committing to doing things in
> a future release because we never really know what will happen in the
> future,

True.  I removed that sentence, leaving a "yet" that hints to the future
without making (I hope) too much of a promise.

> but the biggest problem here is that "it is not supported to
> create foreign keys cannot that reference them" doesn't make any
> sense.  I think you mean something like "creating foreign keys that
> reference a partitioned table is not supported".

Yeah, I edited this a few times and evidently one word from some
previous iteration ("cannot") escaped deletion.  I liked your wording so
I used it.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




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

* Re: pgsql: Foreign keys on partitioned tables
@ 2018-04-06 22:46  Robert Haas <robertmhaas@gmail.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert Haas @ 2018-04-06 22:46 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Fri, Apr 6, 2018 at 4:49 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Robert Haas wrote:
>> On Wed, Apr 4, 2018 at 1:03 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>> > Foreign keys on partitioned tables
>> >
>> > Author: Álvaro Herrera
>> > Discussion: https://postgr.es/m/20171231194359.cvojcour423ulha4@alvherre.pgsql
>> > Reviewed-by: Peter Eisentraut
>>
>> The commit message here was so brief that I had to read the
>> documentation to figure out exactly what this feature was.
>
> I wrote three draft commit messages, and they all seemed to be saying
> something so obvious (just repeating the commit title) that I decided
> not to repeat myself.  Evidently that was a mistake.

Mainly I couldn't tell which direction(s) had been permitted without
looking within.

Not a huge deal, just mentioning it.

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




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


end of thread, other threads:[~2018-04-06 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 17:03 pgsql: Foreign keys on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-04-06 14:13 ` Robert Haas <robertmhaas@gmail.com>
2018-04-06 20:49   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-04-06 22:46     ` 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