pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS
Date: Tue, 31 Aug 2010 10:46:59 -0400
Message-ID: <2683.1283266019@sss.pgh.pa.us> (raw)
In-Reply-To: <alpine.DEB.2.00.1008311337530.2449@localhost.localdomain>
References: <alpine.DEB.2.00.1008311337530.2449@localhost.localdomain>

Fabien COELHO <coelho@cri.ensmp.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



view thread (33+ messages)  latest in thread

Message-ID: <2683.1283266019@sss.pgh.pa.us>
Permalink:  ../2683.1283266019@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2683.1283266019@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, coelho@cri.ensmp.fr, pgsql-bugs@postgresql.org
  Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS
  In-Reply-To: <2683.1283266019@sss.pgh.pa.us>

* 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