Re: Constraint names using 'user namespace'?

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Constraint names using 'user namespace'?
Date: 2000-11-28 05:43:22
Message-ID: 3.0.5.32.20001128164322.00c5a660@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 00:24 28/11/00 -0500, Tom Lane wrote:
>Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
>> Just noticed this:
>
>> pjw=# create table pk1(f1 integer, constraint zzz primary key(f1));
>> NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'zzz' for
>> table 'pk1'
>> CREATE
>> pjw=# create table zzz(f1 integer);
>> ERROR: Relation 'zzz' already exists
>
>> Is there a good reason why the automatically created items do not have a
>> 'pg_' in front of their names?
>
>Not a good idea. I think it should probably be pk1_zzz in this case.

That would at least be consistent, but it's still using 'user namespace'
for system-related items, which seems like a bad practice if it can be
avoided. I don't mind a longer name, if that is your objection:
pg_constraint_pk1_zzz or some such.

>If we do either, it will break the recently submitted pg_dump patch that

Not too hard to fix.

>uses the index name as the constraint name. I thought that patch was
>wrongheaded anyway, and would recommend reversing it...

I wasn't too keen on it, but could not come up with any good arguments
against it. We need a unified approach to constraints, but in the mean time
it seems OK. Do you have any more definite objections?

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-11-28 06:03:27 Re: Constraint names using 'user namespace'?
Previous Message Junfeng Zhang 2000-11-28 05:42:24 Using Threads?