kndndrj / nvim-dbee

Interactive database client for neovim
GNU General Public License v3.0
606 stars 39 forks source link

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

Open willruggiano opened 5 months ago

willruggiano commented 5 months ago
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.

kndndrj commented 2 months ago

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

willruggiano commented 2 months ago

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?

kndndrj commented 2 months ago

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.