Re: Information Schema and constraint names not unique - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Information Schema and constraint names not unique
Date
Msg-id 200311071404.hA7E4t624993@candle.pha.pa.us
Whole thread Raw
In response to Re: Information Schema and constraint names not unique  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Information Schema and constraint names not unique
Re: Information Schema and constraint names not unique
List pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> > On Thu, Nov 06, 2003 at 11:42:13AM -0500, Tom Lane wrote:
> >> I don't have a problem with switching from "$1" to "tablename_$1", or
> >> some such, for auto-generated constraint names.  But if it's not
> >> guaranteed unique, does it really satisfy Philip's concern?
> 
> > It certainly _is_ unique within a schema ...
> > (But what happens to the constraint name when the table is renamed?)
> 
> Exactly.  Also consider manually-assigned constraint names that happen
> to look like "foo_$n" --- these could cause trouble if table foo is
> created later.  To make a guarantee of uniqueness would require more
> infrastructure than just a simple hack of the constraint name generator
> logic.
> 
> BTW we also have some problems with auto-generated names for column
> constraints; these generally look like "tablename_columnname", and
> that's not unique:
> 
> regression=# create table foo (f1 int check (f1 > 0) check (f1 < 10));
> ERROR:  check constraint "foo_f1" already exists

Is this a TODO to fix?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [pgsql-www] Changes to Contributor List
Next
From: Bruce Momjian
Date:
Subject: Re: [pgsql-advocacy] Changes to Contributor List