From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Avoid having two PKs in a partition
Date: Mon, 12 Mar 2018 22:44:53 +0000
Message-ID: <E1evWBZ-0004aN-GR@gemulon.postgresql.org> (raw)
Avoid having two PKs in a partition
If a table containing a primary key is attach as partition to a
partitioned table which has a primary key with a different definition,
we would happily create a second one in the new partition. Oops. It
turns out that this is because an error check in DefineIndex is executed
only if you tell it that it's being run by ALTER TABLE, and the original
code here wasn't. Change it so that it does.
Added a couple of test cases for this, also. A previously working test
started to fail in a different way than before patch because the new
check is called earlier; change the PK to plain UNIQUE so that the new
behavior isn't invoked, so that the test continues to verify what we
want it to verify.
Reported by: Noriyoshi Shinoda
Discussion: https://postgr.es/m/DF4PR8401MB102060EC2615EC9227CC73F7EEDF0@DF4PR8401MB1020.NAMPRD84.PROD.OUTLOOK.C...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1f8a3327a9db9a8a662fb39fdcde2337acffa68c
Modified Files
--------------
src/backend/commands/indexcmds.c | 2 +-
src/backend/commands/tablecmds.c | 2 +-
src/test/regress/expected/indexing.out | 26 +++++++++++++++++++++-----
src/test/regress/sql/indexing.sql | 22 +++++++++++++++++++---
4 files changed, 42 insertions(+), 10 deletions(-)
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: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Avoid having two PKs in a partition
In-Reply-To: <E1evWBZ-0004aN-GR@gemulon.postgresql.org>
References: <E1evWBZ-0004aN-GR@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