From: | "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com> |
---|---|
To: | "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org> |
Subject: | Wrong note in the information schema section? |
Date: | 2021-08-30 12:50:59 |
Message-ID: | GVAP278MB0931DCD66FD3EE21972D0695D2CB9@GVAP278MB0931.CHEP278.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Hi %.
we have this note in the information schema section, e.g. in https://www.postgresql.org/docs/current/information-schema.html
..."This is because the SQL standard requires constraint names to be unique within a schema, but PostgreSQL does not enforce this restriction."
...
PostgreSQL does enforce unique constraint names in a schema:
postgres=# create table t1 ( a int );
CREATE TABLE
postgres=# alter table t1 add constraint c1 unique (a);
ALTER TABLE
postgres=# alter table t1 add constraint c1 unique (a);
ERROR: relation "c1" already exists
Am I reading this wrong? I know you can have the same constraint with different names:
postgres=# create table t1 ( a int );
CREATE TABLE
postgres=# alter table t1 add constraint c2 unique (a);
ALTER TABLE
postgres=# alter table t1 add constraint c3 unique (a);
ALTER TABLE
... but I guess this is not what the notes is supposed to tell me, correct?
Regards
Daniel
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2021-08-30 15:21:59 | Re: Wrong note in the information schema section? |
Previous Message | PG Doc comments form | 2021-08-30 00:20:20 | I came here to determine how much storage a boolean variable uses |