Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Anna Akenteva <a(dot)akenteva(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ...
Date: 2020-07-06 22:08:54
Message-ID: 1473360.1594073334@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> On 2020-Jul-05, Anna Akenteva wrote:
>> -- Swapping primary key's index for an equivalent index,
>> -- but with INCLUDE-d attributes.
>> CREATE UNIQUE INDEX new_idx ON target_tbl (id) INCLUDE (info);
>> ALTER TABLE target_tbl ALTER CONSTRAINT target_tbl_pkey USING INDEX
>> new_idx;
>> ALTER TABLE referencing_tbl ALTER CONSTRAINT referencing_tbl_id_ref_fkey
>> USING INDEX new_idx;

> How is this state represented by pg_dump?

Even if it's possible to represent, I think we should flat out reject
this "feature". Primary keys that aren't primary keys don't seem like
a good idea. For one thing, it won't be possible to describe the
constraint accurately in the information_schema.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Soumyadeep Chakraborty 2020-07-06 22:45:23 Re: posgres 12 bug (partitioned table)
Previous Message Alvaro Herrera 2020-07-06 21:47:35 Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ...