open (in which case all consecutive inserts on the same table would block).
M.K.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of mixo
Sent: Wednesday, June 09, 2004 9:24 AM
To: [EMAIL PROTECTED]
Subject: [SQL] Last insert id
I have three tables which are related
On Tue, 2004-06-15 at 03:05, Andrei Bintintan wrote:
> "Is it safe to use "select max(table1_id) from table1" after the insert?"
>
> Yes it is safe, but ONLY if you use it inside a transaction.(BEGIN/COMMIT).
No, this is not safe outside of the serializable isolation.
rbt=# begin;
BEGIN
rbt=# se
09, 2004 9:24 AM
To: [EMAIL PROTECTED]
Subject: [SQL] Last insert id
I have three tables which are related a serial field, table1_id, in on of
the tables. Updating the tables is done through a transaction. My problem
is, once I have insert a row in the first tables with table1_id, I need for
the o
mixo wrote:
I have three tables which are related a serial field, table1_id, in on
of the tables. Updating the tables is done through a transaction. My
problem is, once I have insert a row in the first tables with
table1_id, I need for the other two tables. How can I get this? Is it
safe to us
I'm new on postgreSQL, so this might not be the simplest sollution:
Use a sequence instead of serial.
After you have generated the new id with your_seq.nextval
you can get thesame number again with your_seq.currval.
details at http://www.postgresql.org/docs/7.3/static/functions-sequence.html
mi
I have three tables which are related a serial field, table1_id, in on
of the tables. Updating the tables is done through a transaction. My
problem is, once I have insert a row in the first tables with
table1_id, I need for the other two tables. How can I get this? Is it
safe to use "select ma