Re: Unique and Primary Key Constraints - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Unique and Primary Key Constraints
Date
Msg-id 3930.1026579835@sss.pgh.pa.us
Whole thread Raw
In response to Re: Unique and Primary Key Constraints  (Rod Taylor <rbt@zort.ca>)
List pgsql-hackers
Rod Taylor <rbt@zort.ca> writes:
> Yup.  Makes sense.  I submitted a patch which retains the difference. 
> If the index is created with CREATE UNIQUE, it's dumped with CREATE
> UNIQUE.  Constraint UNIQUE is treated likewise.

Yes, I was going to suggest that --- we should try to reproduce the way
that the definition was created, not enforce our own ideas of style.

CREATE INDEX will always be more flexible than constraints anyway
(non-default index type, non-default opclasses, partial indexes for
starters) so the notion that it might go away someday is a nonstarter.

Rod's original pg_depend patch tried to make a pg_constraint entry for
any unique index, but I changed it to only make entries for indexes
that were actually made from constraint clauses, so the distinction
is preserved in the system catalogs.  Just a matter of having pg_dump
respect it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Memo on dropping practices
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql/ oc/src/sgml/catalogs.sgml oc/src/sgml/r ...