Fw: pg_TCL and COMMIT - Mailing list pgsql-novice

From Paul Skinner
Subject Fw: pg_TCL and COMMIT
Date
Msg-id 000d01bfed37$979c99b0$02320a0a@k6500
Whole thread Raw
List pgsql-novice
Anybody?
 
----- Original Message -----
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

pgsql-novice by date:

Previous
From: ghaverla@freenet.edmonton.ab.ca
Date:
Subject: Re: tuple maximum size; plpgsql to sendmail?
Next
From: igor
Date:
Subject: win Drivers for postgreSQL 7.0