Re: issue about information_schema REFERENTIAL_CONSTRAINTS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS
Date: 2010-08-31 14:46:59
Message-ID: 2683.1283266019@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-docs

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
> The REFERENTIAL_CONSTRAINTS table in the information_schema references a
> constaint through its database/schema/name, but this information is not
> unique, so it may identify several constraints, thus the information
> derived may not be consistent.

Postgres does not enforce that constraints have unique names within a
schema. The SQL spec does say that they should be unique per-schema,
and the information_schema views are designed on that assumption.

If you use spec-compliant names for your constraints, you won't have a
problem. If you don't, well, the information_schema views will be of
limited use to you.

> Suggestion: constraint names could be systematically prefixed with their
> corresponding table so that they are indeed unique,

We are not going to try to enforce uniqueness. This has been debated
before, and most people like the current behavior just fine, or at least
better than the alternatives.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2010-08-31 15:09:58 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Cristian Bittel 2010-08-31 14:40:33 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

Browse pgsql-docs by date

  From Date Subject
Next Message Thom Brown 2010-08-31 16:09:12 Re: [pgsql-www] Example indenting
Previous Message Fabien COELHO 2010-08-31 12:03:43 issue about information_schema REFERENTIAL_CONSTRAINTS