-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
Using combinations of following:
- py-postgresql: 1.0.2, 1.0.3
- libpg: 8.4.7, 8.4.12, 9.1.4
- PostgreSQL: 9.1.1, 9.1.3
Upon recieving an exception from DBAPI level within some transaction, connection (?) gets stuck in erroneous state and it is not poss possible to rollback the transaction (which results in original exception being returned again and does not emit rollback statement to server side).
import postgresql.driver.dbapi20 as driver
connection = driver.connect(user = 'test', host = 'test', port = '5432', database = 'test', password='test')
try:
cursor = connection.cursor()
cursor.execute('SELECT \'a\'=1;')
connection.commit()
except Exception as e:
print ("Got exception 1 (while executing):\n{}\n".format(e))
try:
connection.rollback()
except Exception as ee:
print ("Got exception 2 (while rolling back):\n{}\n".format(ee))results in:
Got exception 1 (while executing):
ошибка синтаксиса в значении типа integer: "a"
CODE: 22P02
LOCATION: File 'numutils.c', line 62, in pg_atoi from SERVER
POSITION: 8
STATEMENT: [parsing]
LINE:
SELECT 'a'=1;
^ [line 1, character 8]
statement_id: py:0x2e90890
string: SELECT 'a'=1;
CONNECTION: [closed]
client_address: 192.168.1.160/32
client_port: 53660
version:
PostgreSQL 9.1.3 on x86_64-unknown-linux-gnu, compiled by gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit
CONNECTOR: [Host] pq://aust:***@aust.aa:5432/aust
category: None
DRIVER: postgresql.driver.pq3.Driver
Got exception 2 (while rolling back):
ошибка синтаксиса в значении типа integer: "a"
CODE: 22P02
LOCATION: File 'numutils.c', line 62, in pg_atoi from SERVER
POSITION: 8
STATEMENT: [parsing]
LINE:
SELECT 'a'=1;
^ [line 1, character 8]
statement_id: py:0x2e90890
string: SELECT 'a'=1;
CONNECTION: [closed]
client_address: 192.168.1.160/32
client_port: 53660
version:
PostgreSQL 9.1.3 on x86_64-unknown-linux-gnu, compiled by gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit
CONNECTOR: [Host] pq://aust:***@aust.aa:5432/aust
category: None
DRIVER: postgresql.driver.pq3.Driver
at same time when serverside is 8.4.*, the output is as expected:
Got exception 1 (while executing):
invalid input syntax for integer: "a"
CODE: 22P02
LOCATION: File 'numutils.c', line 64, in pg_atoi from SERVER
POSITION: 8
STATEMENT: [parsing]
LINE:
SELECT 'a'=1;
^ [line 1, character 8]
statement_id: py:0x2c6ded0
string: SELECT 'a'=1;
CONNECTION: [failed block]
client_address: 127.0.0.1/32
client_port: 34153
version:
PostgreSQL 8.4.12 on x86_64-pc-linux-gnu, compiled by GCC x86_64-pc-linux-gnu-gcc (Gentoo Hardened 4.6.2 p1.0, pie-0.4.5) 4.6.2, 64-bit
CONNECTOR: [Host] pq://pkolla:***@localhost:5432/aust
category: None
DRIVER: postgresql.driver.pq3.Driver
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels