nvim-dbee icon indicating copy to clipboard operation
nvim-dbee copied to clipboard

[postgres] no output when executing some statements inside of transaction block

Open willruggiano opened this issue 1 year ago • 3 comments

BEGIN;
UPDATE ...;
ROLLBACK;

Running just the UPDATE statement yields the expected output, e.g.

   │ Rows Affected 
───┼───────────────
 1 │             N 

however when run within the transaction block (regardless whether you finish it off with a ROLLBACK or a COMMIT) yields:

  │ No Results 
──┼────────────

It seems that SELECT statements still produce output when run within a transaction block, but UPDATE, INSERT and DELETE statements do not (they all produce the "No Results" output above).

I haven't tested SAVEPOINTs.

willruggiano avatar Jan 30 '24 23:01 willruggiano

Hey, the issue is that the transaction creates multiple result sets - and we currently only support a single one (e.g. the last one), which you guessed is from update - and it produces "no results" result

kndndrj avatar Apr 24 '24 05:04 kndndrj

Hey, the issue is that the transaction creates multiple result sets - and we currently only support a single one (e.g. the last one), which you guessed is from update - and it produces "no results" result

So... the example is a single UPDATE statement within a transaction. Does that still produce multiple result sets? Which would imply that you should never seen output from transaction blocks. Maybe I'm misunderstanding?

willruggiano avatar Apr 24 '24 16:04 willruggiano

Oh, looks like I misunderstood. Well, then it looks like it's a bug.

It would be helpful to look at other database clients and see how they handle this.

kndndrj avatar Apr 26 '24 11:04 kndndrj