| From: | "Gregory Wood" <gregw(at)com-stock(dot)com> |
|---|---|
| To: | "Kostis Mentzelos" <mentzelos(at)ematic(dot)com> |
| Cc: | "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: SERIAL values |
| Date: | 2001-03-02 15:23:47 |
| Message-ID: | 007d01c0a32d$20de4fb0$7889ffcc@comstock.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)ematic(dot)com>
To: <pgsql-general(at)postgresql(dot)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(at)postgresql(dot)org
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mitch Vincent | 2001-03-02 15:52:36 | Re: Convert to upper |
| Previous Message | Raymond Chui | 2001-03-02 15:14:31 | Re: store procedure in pl/pgsql |