pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow NOT VALID foreign key constraints on partitioned tables
Date: Thu, 23 Jan 2025 14:59:38 +0000
Message-ID: <E1taygE-0036kE-Fh@gemulon.postgresql.org> (raw)

Allow NOT VALID foreign key constraints on partitioned tables

This feature was intentionally omitted when FKs were first implemented
for partitioned tables, and had been requested a few times; the
usefulness is clear.

Validation can happen for each partition individually, which is useful
to contain the number of locks held and the duration; or it can be
executed for the partitioning hierarchy as a single command, which
validates all child constraints that haven't been validated already.

This is also useful to implement NOT ENFORCED constraints on top.

Author: Amul Sul <sulamul@gmail.com>
Discussion: https://postgr.es/m/CAAJ_b96Bp=-ZwihPPtuaNX=SrZ0U6ZsXD3+fgARO0JuKa8v2jQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml         |   2 -
src/backend/commands/tablecmds.c          | 150 +++++++++++++++++++++---------
src/test/regress/expected/foreign_key.out |  97 +++++++++++++++++--
src/test/regress/sql/foreign_key.sql      |  72 +++++++++++++-
4 files changed, 263 insertions(+), 58 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1taygE-0036kE-Fh@gemulon.postgresql.org>
Permalink:  ../E1taygE-0036kE-Fh@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1taygE-0036kE-Fh@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Allow NOT VALID foreign key constraints on partitioned tables
  In-Reply-To: <E1taygE-0036kE-Fh@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