From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Create a deferrably-unique index |
Date: | 2013-08-19 19:01:34 |
Message-ID: | 24779.1376938894@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> writes:
>> Deferrability is a property of a constraint, not an index
> Yes, but creating a unique constraint implicitly creates an index, and
> creating a unique index implicitly creates a constraint.
No, it doesn't. I'm using "constraint" in a technical sense here,
that is something that is recorded as a constraint in the system
catalogs.
regression=# select count(*) from pg_constraint;
count
-------
34
(1 row)
regression=# create table foo(f1 int unique);
CREATE TABLE
regression=# select count(*) from pg_constraint;
count
-------
35
(1 row)
regression=# create table bar(f1 int);
CREATE TABLE
regression=# create unique index on bar(f1);
CREATE INDEX
regression=# select count(*) from pg_constraint;
count
-------
35
(1 row)
The index on bar didn't create a constraint.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Boszormenyi Zoltan | 2013-08-19 19:02:21 | Re: [GENERAL] currval and DISCARD ALL |
Previous Message | Paul Jungwirth | 2013-08-19 18:43:57 | Re: Create a deferrably-unique index |