BUG #2299: pg_dump error w/ renamed primary keys

From: "Gavin Scott" <gavin(at)planetacetech(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2299: pg_dump error w/ renamed primary keys
Date: 2006-03-03 18:18:07
Message-ID: 20060303181807.05EB5F0B06@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2299
Logged by: Gavin Scott
Email address: gavin(at)planetacetech(dot)com
PostgreSQL version: 8.1.3
Operating system: fedora core 4
Description: pg_dump error w/ renamed primary keys
Details:

If you rename a primary key, pg_dump tries to recreate it with the original
name. Here is how to recreate:

[postgres81(at)boll ~]$ createdb bug
CREATE DATABASE
[postgres81(at)boll ~]$ psql bug << EOF
> CREATE TABLE foo ( id integer );
> ALTER TABLE foo ADD CONSTRAINT foo_pkey PRIMARY KEY (id);
> ALTER TABLE foo_pkey RENAME TO bar_pkey;
> EOF
CREATE TABLE
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "foo_pkey"
for table "foo"
ALTER TABLE
ALTER TABLE
[postgres81(at)boll ~]$ echo '\d foo' | psql bug
Table "public.foo"
Column | Type | Modifiers
--------+---------+-----------
id | integer | not null
Indexes:
"bar_pkey" PRIMARY KEY, btree (id)

[postgres81(at)boll ~]$ pg_dump bug | grep -B 1 -i key
--
-- Name: foo_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres81;
Tablespace:
--
ALTER TABLE ONLY foo
ADD CONSTRAINT foo_pkey PRIMARY KEY (id);

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Raymond Henick 2006-03-03 19:56:14 General PostgresSQL Query
Previous Message Dhanaraj 2006-03-03 11:51:52 Re: prepare-alter-exec issue