Skip site navigation (1) Skip section navigation (2)

Review of patch renaming constraints

From: Joshua Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Review of patch renaming constraints
Date: 2012-01-13 04:43:38
Message-ID: 1216229788.2620.1326429818474.JavaMail.root@mail-1.01.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Compiling on Ubuntu 10.04 LTS AMD64 on a GoGrid virtual machine from 2012-01-12 git checkout.

Patch applied fine.

Docs are present, build, look good and are clear.

Changes to gram.y required Bison 2.5 to compile.  Are we requiring Bison 2.5 now?  There's no configure check for it, so it took me quite a while to figure out what was wrong.

Make check passed.  Patch has tests for rename constraint.

Most normal uses of alter table ... rename constraint ... worked normally.  However, the patch does not deal correctly with constraints which are not inherited, such as primary key constraints:

create table master ( category text not null, status int not null, value text );

alter table master add constraint master_key primary key ( category, status );

alter table master rename constraint master_key to master_primary_key;

create table partition_1 () inherits ( master );

create table partition_2 () inherits ( master );

alter table master rename constraint master_primary_key to master_key;

postgres=# alter table master rename constraint master_primary_key to master_key;
ERROR:  constraint "master_primary_key" for table "partition_1" does not exist
STATEMENT:  alter table master rename constraint master_primary_key to master_key;
ERROR:  constraint "master_primary_key" for table "partition_1" does not exist


-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
San Francisco

Responses

pgsql-hackers by date

Next:From: Linh NguyenDate: 2012-01-13 04:46:57
Subject: Patch: DROP INDEX CONCURRENTLY partially reviewed
Previous:From: YAMAMOTO TakashiDate: 2012-01-13 04:24:12
Subject: gistVacuumUpdate

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group