pg_query transaction: auto rollback? begin or start?? commit or end???

From: "Bill Wordsworth" <bill(dot)wordsworth(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_query transaction: auto rollback? begin or start?? commit or end???
Date: 2008-07-22 17:02:48
Message-ID: 1e07a2bd0807221002q730f5f2ag7d7cedc6993f41c2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is this recommended?

pg_query("begin transaction read write;", $connection);
if(pg_transaction_status($connection) == 2) {
pg_query("insert...;", $connection);
pg_query("insert...;", $connection);
pg_query("insert...;", $connection);
}
pg_query("commit transaction;", $connection);
pg_close($connection);

Now *any* error inside transaction will trigger auto rollback for
*all* inserts so I don't need to explicitly issue conditional
rollback? Also is "begin/commit transaction" == "start/end
transaction"??
Cheers, Bill

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-07-22 17:08:21 Re: Initdb problem on debian mips cobalt: Bus error
Previous Message Ben 2008-07-22 16:49:20 Re: ER diagram software