pgsql: Assign constraint name when cloning FK definition for partitions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Assign constraint name when cloning FK definition for partitions
Date: 2018-10-06 06:00:23
Message-ID: E1g8fdX-00025G-US@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL_11_STABLE

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

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

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2018-10-06 10:27:44 pgsql: Improve the accuracy of floating point statistical aggregates.
Previous Message Bruce Momjian 2018-10-05 21:20:36 pgsql: doc: update PG 11 release notes