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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql-server: Clean up generation of default names
Дата
Msg-id 17633.1086917654@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql-server: Clean up generation of default names  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-committers
Christopher Kings-Lynne <chriskl@familyhealth.com.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

В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql-server: Fix oversight in recent ALTER TABLE
Следующее
От: momjian@svr1.postgresql.org (Bruce Momjian)
Дата:
Сообщение: pgsql-server: This patch updates pgpipe() on win32 to log exactly which