Skip site navigation (1) Skip section navigation (2)

Re: pg metadata and doc bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg metadata and doc bug
Date: 2008-11-25 20:06:33
Message-ID: 5138.1227643593@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
> The issue is that when one does (in pg 8.3.5)
>  	ALTER TABLE foo ADD CONSTRAINT xxx UNIQUE ON (...);
> this results in a constraint *and* an index, but when one does only the 
> corresponding:
>  	CREATE UNIQUE INDEX foo(...);
> then the index is created but there is no constraint.

This is intentional.  You didn't create a constraint in the sense of the
SQL standard, and furthermore it may very well be impossible to
represent the index as a constraint in information_schema.  (For
instance, the index might be functional or partial --- in fact, it most
likely is special in some way, or you'd not have bothered to use the
nonstandard syntax to make it.)


> Also, there is a minor bug in the documentation, which was the another 
> source of my troubles:
>   information_schema.KEY_COLUMN_USAGE.position_in_unique_constraint
> is tagged as "NOT IMPLEMENTED", but it looks like it is implemented.

Yeah, looks like the documentation is out of date there.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Fabien COELHODate: 2008-11-25 20:30:02
Subject: Re: pg metadata and doc bug
Previous:From: Fabien COELHODate: 2008-11-25 19:47:07
Subject: pg metadata and doc bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group