Re: Primary key error in INFORMATION_SCHEMA views - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Primary key error in INFORMATION_SCHEMA views
Date
Msg-id 8886.1527107987@sss.pgh.pa.us
Whole thread Raw
In response to Primary key error in INFORMATION_SCHEMA views  (SQLpro <sqlpro@sqlspot.com>)
Responses Re: Primary key error in INFORMATION_SCHEMA views
List pgsql-bugs
SQLpro <sqlpro@sqlspot.com> writes:
> The Following script demonstrate the bug: 

> CREATE SCHEMA s; 
> CREATE TABLE s.foo (C INT); 
> ALTER TABLE s.foo ADD CONSTRAINT k CHECK(C>0); 
> CREATE TABLE s.foo2 (C INT); 
> ALTER TABLE s.foo2 ADD CONSTRAINT k CHECK(C>=1); 

> This last SQL command should fail because the database name, the schema name
> and the constraint name is the same for those two constraints, but did'nt ! 

Indeed, but Postgres does not require check constraints to be named
uniquely across the whole schema, only per-table.  Tightening that would
be a cure worse than the disease, because it would break applications
that work today.

So, sorry, we do not consider this a bug, and it's highly unlikely that
we'd ever "fix" it.  You're surely free to use only spec-compliant choices
of constraint names in your own databases if you wish, but PG won't
enforce that.

            regards, tom lane


pgsql-bugs by date:

Previous
From: SQLpro
Date:
Subject: Primary key error in INFORMATION_SCHEMA views
Next
From: Jeremy Schneider
Date:
Subject: Re: BUG #14820: Standby crash with "could not access status oftransaction" (for track_commit_timestamp)