Why am I getting a warning about "no transaction in progress" after a COMMIT
even when I have explicitly started a transaction with START TRANSACTION
(works the same as BEGIN
)? This will occur 90% of the time for this specific transaction, but other times the commit will succeed. I'm using postgres 9.3. Here's the postgres log:
2014-07-04 21:47:19 EST LOG: statement: START TRANSACTION;
2014-07-04 21:47:19 EST LOG: statement: SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
2014-07-04 21:47:19 EST LOG: statement: SET autocommit = 1;
2014-07-04 21:47:19 EST LOG: statement: SET TIME ZONE 'UTC'
2014-07-04 21:47:19 EST LOG: statement: INSERT INTO "Users" (...) VALUES (...) RETURNING *;
2014-07-04 21:47:19 EST LOG: statement: INSERT INTO "Profiles" (...) RETURNING *;
2014-07-04 21:47:19 EST LOG: statement: SET TIME ZONE 'UTC'
2014-07-04 21:47:19 EST LOG: statement: INSERT INTO "Sessions" (...) VALUES (...) RETURNING *;
2014-07-04 21:47:20 EST LOG: statement: COMMIT;
2014-07-04 21:47:20 EST WARNING: there is no transaction in progress
You are using autocommit. When using autocommit, explicitly starting a transaction is meaningless.
Remove the line "set autocommit = 1" or change the 1 to "off" or an equivalent value and this should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.