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

Re: pgsql-server: Clean up generation of default names

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql-server: Clean up generation of default names
Date: 2004-06-11 01:34:14
Message-ID: 17633.1086917654@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> Clean up generation of default names for constraints, indexes, and serial
>> sequences, as per recent discussion.

> Do you do any sort of 'locking of potential names' to ensure that 
> another process adding a sequence at the same time or something won't 
> get the same name first, causing yours to still fail or break uniqueness?

It's not 100% bulletproof, but I'd say that in practice I don't expect
any problems.  For instance, since all the generated names start with
the base relation name, in the absence of truncation there can't be any
such conflict --- ALTER TABLE will be holding an exclusive lock on the
base relation, and in the CREATE TABLE case you're going to die on the
base relation name conflict anyway.

If you use sufficiently long table/field names then different tables
could truncate to the same generated names, and in that case there's
some risk of concurrently choosing the same "unique" name.  But I don't
recall anyone having complained of that since we started using this
technique for choosing index names, so I'm not very worried.  Basically
what this commit did was propagate the index naming technique to
constraints and sequences.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Christopher Kings-LynneDate: 2004-06-11 01:49:25
Subject: Re: [COMMITTERS] pgsql-server: Clean up generation of default names
Previous:From: Tom LaneDate: 2004-06-11 01:19:39
Subject: Re: Delaying the planning of unnamed statements until Bind

pgsql-committers by date

Next:From: Christopher Kings-LynneDate: 2004-06-11 01:49:25
Subject: Re: [COMMITTERS] pgsql-server: Clean up generation of default names
Previous:From: Tom LaneDate: 2004-06-11 01:27:39
Subject: Re: pgsql-server: Fix oversight in recent ALTER TABLE

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