pg_TCL and COMMIT

From: "Paul Skinner" <skin(at)skin(dot)dhs(dot)org>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: pg_TCL and COMMIT
Date: 2000-07-10 21:30:20
Message-ID: 003501bfeab6$0c8dcbb0$02320a0a@k6500
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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 James Hall 2000-07-10 21:54:43 Perl and pg_dump
Previous Message Manuel Sugawara 2000-07-10 19:29:03 Re: order by accents?