ALTER TABLE .. ADD PRIMARY KEY .. USING INDEX has dump-restore hazard - Mailing list pgsql-hackers

From Robert Haas
Subject ALTER TABLE .. ADD PRIMARY KEY .. USING INDEX has dump-restore hazard
Date
Msg-id CA+TgmoYMsEPePx6J2oQHRqRmZuSQevFBbabyji6To1NK3TUs1Q@mail.gmail.com
Whole thread Raw
Responses Re: ALTER TABLE .. ADD PRIMARY KEY .. USING INDEX has dump-restore hazard  (Michael Paquier <michael.paquier@gmail.com>)
Re: ALTER TABLE .. ADD PRIMARY KEY .. USING INDEX has dump-restore hazard  (Gurjeet Singh <gurjeet@singh.im>)
List 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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Fillfactor for GIN indexes
Next
From: Alexander Korotkov
Date:
Subject: Re: Selectivity estimation for intarray with @@