ALTER TABLE .. ADD PRIMARY KEY .. USING INDEX has dump-restore hazard

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: ALTER TABLE .. ADD PRIMARY KEY .. USING INDEX has dump-restore hazard
Date: 2015-07-21 16:23:47
Message-ID: CA+TgmoYMsEPePx6J2oQHRqRmZuSQevFBbabyji6To1NK3TUs1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Consider:

rhaas=# create table foo (a text);
CREATE TABLE
rhaas=# create unique index on foo (a collate "C");
CREATE INDEX
rhaas=# alter table foo add primary key using index foo_a_idx;
ALTER TABLE
rhaas=# \d foo
Table "public.foo"
Column | Type | Modifiers
--------+------+-----------
a | text | not null
Indexes:
"foo_a_idx" PRIMARY KEY, btree (a COLLATE "C")

Now dump and restore this database. Then:

rhaas=# \d foo
Table "public.foo"
Column | Type | Modifiers
--------+------+-----------
a | text | not null
Indexes:
"foo_a_idx" PRIMARY KEY, btree (a)

Notice that the collation specifier is gone. Oops.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2015-07-21 16:28:01 Re: Selectivity estimation for intarray with @@
Previous Message Heikki Linnakangas 2015-07-21 16:20:12 Re: Fillfactor for GIN indexes