Re: Generate user/group sysids from a sequence?

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: Generate user/group sysids from a sequence?
Дата
Msg-id 20030117172012.GD15778@wallace.ece.rice.edu
обсуждение исходный текст
Ответ на Re: Generate user/group sysids from a sequence?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
On Fri, Jan 17, 2003 at 11:38:24AM -0500, Bruce Momjian wrote:
> Tom Lane wrote:
> > 
> > A small difficulty is that explicitly-specified sysids could conflict
> > with sysids generated later by the sequence.  We could perhaps fix this
> > by forcing up the sequence setting to be at least as large as an
> > explicitly-given ID (compare the handling of explicitly loaded OIDs).
> 
> A sequence sounds like a good idea.  When we create a user, we can use
> MAX() to find the maximum, and if that is less than the sequence value,
> bump up the sequence to equal max and add the row, again incrementing
> the sequence.  Another idea would be to put a trigger on the column so
> that any INSERT/UPDATE would automatically bump up the sequence with
> setval().
> 

Hmm, unlike the OID case, I'd think there's unlikely to be many 'preused'
userids. Why not just retry if the sequence hits an existing entry? 

Ross


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Win32 port
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Generate user/group sysids from a sequence?