Skip to content

Preparing an invalid statement during a read/write transaction does not invalidate the transaction #460

Description

@olavloite

Preparing an invalid statement during a transaction should put that transaction in the Aborted state. PGAdapter does not do that:

PGAdapter

knut-test-db=> begin;
BEGIN
knut-test-db=*> prepare s as select * from foo;
ERROR:  relation "foo" does not exist - Statement: 'select * from foo'
knut-test-db=*> select 1;
 ?column? 
----------
        1
(1 row)

knut-test-db=*> rollback;
ROLLBACK
knut-test-db=> 

PostgreSQL

knut-test-db=# select * from foo;
 id | colfoo  
----+---------
  1 | (1,One)
(1 row)

knut-test-db=# begin;
BEGIN
knut-test-db=*# prepare s as select * from bar;
ERROR:  relation "bar" does not exist
LINE 1: prepare s as select * from bar;
                                   ^
knut-test-db=!# select 1;
ERROR:  current transaction is aborted, commands ignored until end of transaction block
knut-test-db=!# 

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions