Re: getting back autonumber just inserted

Поиск
Список
Период
Сортировка
От Vivek Khera
Тема Re: getting back autonumber just inserted
Дата
Msg-id DC3A639A-7409-419C-9D1A-DABC091873F1@khera.org
обсуждение исходный текст
Ответ на Re: getting back autonumber just inserted  (Theodore Petrosky <tedpet5@yahoo.com>)
Ответы int to date  (Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>)
Список pgsql-sql
On Jul 7, 2005, at 4:14 PM, Theodore Petrosky wrote:

>
> you have to use currval inside a transaction...
>
> begin;
> insert something that increments the counter;
> select currval('sequence_name');
> end;
>
> using currval inside a transaction guarantees that the
> value is correct for your insert statement and has not
> changed by another insert statement.
>

your understanding of currval() is completely incorrect.  no  
transaction is required.


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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Generating a range of integers in a query
Следующее
От: Rob
Дата:
Сообщение: Sql Query help: Remove Sub Selects