Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9570A9FB75B for ; Thu, 1 Mar 2007 07:06:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 30386-04 for ; Thu, 1 Mar 2007 07:06:41 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.242]) by postgresql.org (Postfix) with ESMTP id A07729FB5A1 for ; Thu, 1 Mar 2007 07:06:41 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c24so341837ana for ; Thu, 01 Mar 2007 03:06:40 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=AqTNekL+RCtCS8BFL73/M3y/PLwGCVl8zl83G4Uz3XKijqBUU2LYhk+QhE7encWUhWotka+x4Qfw5jOWZGEg+w2kcYWpApGGMC7ZzqhD4m6x+5/skq67BZ5Ajryyvpi1OJRuZtq2dx/E0rpJHBTnx0VKaYvMp3bZLGKcDi2cD1A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=PIXhvggTOYzLYGYmzlKPOytBowC4RNIJv0clhnQxb/XApolexWnYa+aI06Z//G3hdzW1rwb/+PRqduiVkq6/w5P8Kxbah5Io7DmjO4mLx+MSDvgJBATjueCq7ajDN3qW0+dzIrjNH588TF86r6xVh7OF9Kl0qyuuCtIES0OvNro= Received: by 10.100.11.7 with SMTP id 7mr1325520ank.1172747200471; Thu, 01 Mar 2007 03:06:40 -0800 (PST) Received: by 10.100.165.1 with HTTP; Thu, 1 Mar 2007 03:06:40 -0800 (PST) Message-ID: Date: Thu, 1 Mar 2007 12:06:40 +0100 From: mikie To: pgsql-php@postgresql.org Subject: transactions from PHP - double COMMIT required? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/1 X-Sequence-Number: 3713 Hi, I have this problem - after sending a query from PHP script with BEGIN-COMMIT transaction block that contains an error (e.g. I intentionally insert wrong data into the field of "date" type) I get an error (which is OK):ERROR: date/time field value out of range. Now, when I try to DELETE or perform some other query later in the same PHP script I receive this error: ERROR: current transaction is aborted, commands ignored until end of transaction block I am 100% sure that I have closed the transaction block with "COMMIT;". When I do the same in the console (psql) I get something like: BEGIN; INSERT INTO table1 (somecolumn) VALUES ('somedata'); INSERTsdf; COMMIT; I get this reply BEGIN INSERT 180610 1 ERROR: syntax error at or near "INSERTsdf" at character 1 ROLLBACK Everything seems to be logical and works fine. So why this does not work from PHP? I figured one thing to workaround my problem: I am sending the query like this: BEGIN; (here are few insert queries, one is syntax error); COMMIT; Then I check the pg_result of this query in PHP, and if it is FALSE I have to send another simple query : "COMMIT;" - yes I know this is second commit already. But it works this way! It seems like if PHP ignored my COMMIT command from the transaction query. I also tried sending the transaction query like this: BEGIN; some queries; COMMIT;COMMIT; but this is not working. I need to send one transaction query, check if the result is false, then send another COMMIT. Any ideas where I got something missed? Regards, Mike