Re: My very first PL/pgSQL procedure...

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: My very first PL/pgSQL procedure...
Дата
Msg-id 20060128151608.GB16773@svana.org
обсуждение исходный текст
Ответ на Re: My very first PL/pgSQL procedure...  (Philippe Ferreira <phil.f@worldonline.fr>)
Ответы Re: My very first PL/pgSQL procedure...  (Philippe Ferreira <phil.f@worldonline.fr>)
Список pgsql-general
On Thu, Jan 26, 2006 at 09:04:25PM +0100, Philippe Ferreira wrote:
> But because the sequence could not be locked, some concurrent
> transactions could have already raised it's current value in the
> meantime to, say, "1002", before the effective execution of setval().

Umm, locking sequences won't ever happen. The *whole point* of
sequences is that you get a unique number and you don't have to wait
for it. By locking you'd be telling other people they have to wait.

> So, instead of raising the value to 1000, my function could have
> done the opposite (from 1002 to 1000) ! And the two next "INSERT"
> using this sequence would then break !!

I think you need to provide a rationale why you want to control the
value of the sequence in such a way anyway, because you're trying to do
something that the system isn't likely to support. The numbers are
supposed to be "opaque", the actual values are not supposed to be
relevent.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Encoding errors when upgrading from 7.4 to 8.1
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Basic questions about PQprepare()