ejc-sql
ejc-sql copied to clipboard
Transaction rollback not working
Sometimes I want to test a query on my dataset, and rollback after inspecting its results.
Unfortunately, the following query when executed with ejc-sql
, does not rollback the transaction.
Could you point me if this a bug, misusage ~from~ of the library, or simply a desired outcome? If this is a bug, I am happy to investigate and provide a solution, but I want to get first your thoughts on this.
Thanks.
Steps to reproduce:
- ejc-sql: 0.4.1
- Emacs: 28.0.90
- postgres driver: postgresql-42.3.3.jar
- Execute the two blocks sequentially with
C-c C-c (ejc-eval-use-sql-at-point)
(postgres example)
CREATE TABLE test (id BIGINT, field VARCHAR);
INSERT INTO test(id, field) VALUES (1, NULL);
/
BEGIN;
UPDATE test SET field = 1234 WHERE id = 1;
SELECT field FROM test WHERE id = 1; -- returns 1234
ROLLBACK;
SELECT * FROM test WHERE id = 1; -- returns 1234, whereas it should return null
/
Maybe case every single statment be executed within an independent transaction