From: Daniel Westermann (DWE) <daniel.westermann@dbi-services.com>
To: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Wrong note in the information schema section?
Date: Mon, 30 Aug 2021 12:50:59 +0000
Message-ID: <GVAP278MB0931DCD66FD3EE21972D0695D2CB9@GVAP278MB0931.CHEP278.PROD.OUTLOOK.COM> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: daniel.westermann@dbi-services.com, pgsql-docs@lists.postgresql.org
Subject: Re: Wrong note in the information schema section?
In-Reply-To: <GVAP278MB0931DCD66FD3EE21972D0695D2CB9@GVAP278MB0931.CHEP278.PROD.OUTLOOK.COM>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox