Re: Insert Data and autonumeric field - Mailing list pgsql-sql

From Tom Lane
Subject Re: Insert Data and autonumeric field
Date
Msg-id 20383.1170354739@sss.pgh.pa.us
Whole thread Raw
In response to Insert Data and autonumeric field  (André José Guergolet <AGuergolet@compugraf.com.br>)
List pgsql-sql
André José Guergolet <AGuergolet@compugraf.com.br> writes:
>         INSERT INTO table1 (date, field2, field3) VALUES (now,'value2','value3');
>         SELECT last_value FROM seq_table1;

You should never ever look directly at the sequence table (except
perhaps for manual debugging purposes).  I think you may have confused
this with use of the lastval() function --- currval() or sometimes
lastval() are the appropriate way to get the last-assigned value.
        regards, tom lane


pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Insert Data and autonumeric field
Next
From: Andrew Sullivan
Date:
Subject: Re: Differentiate Between Zero-Length String and NULLColumn Values