Fw: pg_TCL and COMMIT

From: "Paul Skinner" <skin(at)skin(dot)dhs(dot)org>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Fw: pg_TCL and COMMIT
Date: 2000-07-14 02:02:40
Message-ID: 000d01bfed37$979c99b0$02320a0a@k6500
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Anybody?

----- Original Message -----
From: Paul Skinner
To: pgsql-novice(at)postgresql(dot)org
Sent: Monday, July 10, 2000 5:30 PM
Subject: pg_TCL and COMMIT

Greetings,

Just joined the list and hope someone can answer this for me.

Why can't I successfully use a SELECT statement within a transaction (BEGIN) ? I get a message saying that the transaction is aborted, as a result I have to build all my queries in a list and issue them to the backend on the outside of a loop. I pretty sure I did it with oratcl for 8.0.x but I don't have an environment ready to try it...

.... set srvrrules ""
# An array of hosts and info...
foreach rule [array names rules_array] {
# Get the key to the rule
set ruleidx [findrule $rule $conn]
# If it didn't return, add the rule to the DB ...
if {[string length $ruleidx] == 0} {
addrule $rule $conn
}
# .... and get it's key.
set ruleidx [findrule $rule $conn]
# RUNNING THE UPDATE HERE WOULD BE COOL!!
# but I add it to a list instead, because putting the key checks in the BEGIN;
# causes the TX to abort.

lappend SQLRules [ SQLaddsrvrrule $ruleidx $srvridx $rules_array($rule)]
}
ExecSql "BEGIN;" $conn
ExecSql "Delete from GG_srvr_rules where srvr = $srvridx;" $conn
ExecSql "update GG_players set online = 'f' where srvr = $srvridx" $conn

foreach statement $SQLRules {
ExecSql $statement $conn
}
ExecSql "COMMIT;" $conn
unset SQLRules
....

Paul

Browse pgsql-novice by date

  From Date Subject
Next Message igor 2000-07-14 04:10:30 win Drivers for postgreSQL 7.0
Previous Message ghaverla 2000-07-13 23:01:53 Re: tuple maximum size; plpgsql to sendmail?