Re: SERIAL values

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: SERIAL values
Дата
Msg-id 007d01c0a32d$20de4fb0$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на SERIAL values  (Kostis Mentzelos <mentzelos@ematic.com>)
Ответы Re: Re: SERIAL values
Список pgsql-general
SELECT currval('Table_SerialField_SEQ');

Note: This selects the last value of the sequence defined by your SERIAL
sequence, not necessarily the value in your INSERT. For example:

1. User A INSERTs.
2. User B INSERTs.
3. User A performs SELECT currval, which returns the value for User B's
INSERT.

If this could be a potential problem, I recommend peforming a:

SELECT nextval('Table_SerialField_SEQ');

*before* you perform the INSERT, and explicitly using that value.

Greg

----- Original Message -----
From: "Kostis Mentzelos" <mentzelos@ematic.com>
To: <pgsql-general@postgresql.org>
Sent: Thursday, March 01, 2001 5:53 PM
Subject: SERIAL values


> Hi all,
>
> how can I get the current values from SERIAL types after an INSERT using
>
> libpq?
>
>
> Thanks,
> kostis.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


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

Предыдущее
От: "Mitch Vincent"
Дата:
Сообщение: Re: Want to learn the Postgresql database system
Следующее
От: "Martin A. Marques"
Дата:
Сообщение: Re: platforms