From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | Michael Shapiro <mshapiro51(at)gmail(dot)com> |
Cc: | Magnus Hagander <magnus(at)hagander(dot)net>, Aren Cambre <aren(at)arencambre(dot)com>, pgadmin-support(at)postgresql(dot)org |
Subject: | Re: Foreign key UI bug |
Date: | 2010-11-20 17:48:46 |
Message-ID: | 4CE809FE.3010109@lelarge.info |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support |
Le 20/11/2010 16:09, Guillaume Lelarge a écrit :
> Le 20/11/2010 15:15, Michael Shapiro a écrit :
>> Theoretically, you could have the same problem with the primary key -- there
>> could be an index with that name already.
>
> If it happens, it would be PostgreSQL fault, not pgAdmin. The name of
> the constraint and the name of the index, in a primary key and in a
> unique contraint, are determined by PostgreSQL, not pgAdmin. On the
> contrario, the name of the index of a foreign key is determined by
> pgAdmin because this is not a PostgreSQL feature.
>
>> But in practice it doesn't happen. You could generate a name for the foreign
>> key based on similar pattern for the pk
>> and if it fails, then it falls on the user to provide a name. Seem like it
>> would work 99% of the time.
>>
>
> I guess Magnus's idea is the good one (fk_tablename_columnname).
>
The issue in this idea is that you can have more than one column in a
foreignkey. Yes, I know we can put all of them till we reach 63
characters. But it feels quite a burden.
The simple patch attached forces one to type either the constraint name
or the index name. Which seems enough for me.
Any new objections? :)
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
Attachment | Content-Type | Size |
---|---|---|
0001-Force-typing-the-constraint-name-or-the-index-name.patch | text/x-diff | 0 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Aren Cambre | 2010-11-20 23:12:52 | Re: Foreign key UI bug |
Previous Message | Guillaume Lelarge | 2010-11-20 15:09:27 | Re: Foreign key UI bug |