Re: [GENERAL] SEQUENCE primary key

2007-02-13 Thread Tom Lane
Chris <[EMAIL PROTECTED]> writes: > Actually it's better to use currval. Right. Also, in 8.2 and up there's INSERT RETURNING, which is far more flexible --- for instance it could pull back an insertion timestamp. regards, tom lane ---(end of broad

Re: [GENERAL] SEQUENCE primary key

2007-02-13 Thread Chris
John McCawley wrote: In PostgreSQL 8 and up: SELECT lastval(); Actually it's better to use currval. See http://people.planetpostgresql.org/xzilla/index.php?/archives/169-Is-lastval-evil.html -- Postgresql & php tutorials http://www.designmagick.com/ ---(end of broa

Re: [GENERAL] SEQUENCE primary key

2007-02-13 Thread John McCawley
In PostgreSQL 8 and up: SELECT lastval(); gustavo halperin wrote: Hello I have a question, if I have a table with a SEQUENCE primary key, that obviously, I doesn't give in each new row inserted. For example if the table locks: CREATE SEQUENCE id_seq; CREATE TABLE table ( idintege

[GENERAL] SEQUENCE primary key

2007-02-13 Thread gustavo halperin
Hello I have a question, if I have a table with a SEQUENCE primary key, that obviously, I doesn't give in each new row inserted. For example if the table locks: CREATE SEQUENCE id_seq; CREATE TABLE table ( idinteger DEFAULT nextval('id_seq') CONSTRAINT table_id PRIMARY KEY