Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction rollback not working #167

Open
sienic opened this issue Apr 9, 2022 · 1 comment
Open

Transaction rollback not working #167

sienic opened this issue Apr 9, 2022 · 1 comment

Comments

@sienic
Copy link
Contributor

sienic commented Apr 9, 2022

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
/
@sincebyte
Copy link

Maybe case every single statment be executed within an independent transaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants