pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Assign constraint name when cloning FK definition for partitions
Date: Sat, 06 Oct 2018 06:00:23 +0000
Message-ID: <E1g8fdX-00025F-UO@gemulon.postgresql.org> (raw)

Assign constraint name when cloning FK definition for partitions

This is for example used when attaching a partition to a partitioned
table which includes foreign keys, and in this case the constraint name
has been missing in the data cloned.  This could lead to hard crashes,
as when validating the foreign key constraint, the constraint name is
always expected.  Particularly, when using log_min_messages >= DEBUG1, a
log message would be generated with this unassigned constraint name,
leading to an assertion failure on HEAD.

While on it, rename a variable in ATExecAttachPartition which was
declared twice with the same name.

Author: Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/20181005042236.GG1629@paquier.xyz
Backpatch-through: 11

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/38921d1416c62bb743f6cc5439d0462efefdb286

Modified Files
--------------
src/backend/catalog/pg_constraint.c |  1 +
src/backend/commands/tablecmds.c    | 14 +++++++-------
2 files changed, 8 insertions(+), 7 deletions(-)



view thread (2+ messages)

Message-ID: <E1g8fdX-00025F-UO@gemulon.postgresql.org>
Permalink:  ../E1g8fdX-00025F-UO@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g8fdX-00025F-UO@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: michael@paquier.xyz
  Subject: Re: pgsql: Assign constraint name when cloning FK definition for partitions
  In-Reply-To: <E1g8fdX-00025F-UO@gemulon.postgresql.org>
  References: <E1g8fdX-00025F-UO@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