ROLLBACK syntax error in pgadmin4

From: Malik Rumi <malik(dot)a(dot)rumi(at)gmail(dot)com>
To: pgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: ROLLBACK syntax error in pgadmin4
Date: 2016-11-29 18:17:09
Message-ID: CAKd6oBx3igGu=DX3zCqAbLi6FL068hv3LAH-1ySjBSgJvSrsuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

I am using PGAdmin4 with PG 9.4 on Ubuntu 16.04 64 bit. I wanted to do an
update, but was unsure of the result, so I unselected autocommit and ran
explain. It said only one row was affected, which I didn’t understand,
because it should have affected at least 2. Then I inferred that the ‘one
row’ being referred to was the plan, not the rows in my data.

Then I ran the update, again no autocommit, and it was not what I expected.
So then I added ROLLBACK to the end of the query, ran it again, and got
this error:

ERROR: syntax error at or near "ROLLBACK" LINE 1: ...de" SET childof_id =
NULL WHERE codelevelsortseq=1 ROLLBACK;

I then did a new query, with just ROLLBACK; as I see it explained with an
example in the docs:
https://www.postgresql.org/docs/9.4/static/sql-rollback.html

Nevertheless, I got the same error:

ERROR: syntax error at or near "ROLLBACK" LINE 1: ...F, VERBOSE ON, COSTS
ON, BUFFERS OFF, TIMING OFF) ROLLBACK;

Note in this case ROLLBACK; is the only thing on Line 1. The error carat
(^) is pointing at the R in both cases. No other queries have been run in
the interim.

To my surprise, there are very few Google hits for this exact search:

"syntax error at or near 'ROLLBACK'" About 30 results (0.34 seconds)

The first two hits are for a bug report from Nov. of 2006, which was fixed
then and there. I don’t think this is the same bug, if it is a bug.

I did find DISCARD in the docs:
https://www.postgresql.org/docs/9.4/static/sql-discard.html however, I have
not run it because I wanted some clarity here and didn’t want to interfere
with my ROLLBACK, if it would even have that effect.

So, my questions:

1. How do I discard this update and get my data back?

2. How do I check to make sure it really isn’t committed without upsetting
my ROLLBACK options? (Yes, I do have a backup I can go to, but I would
rather understand what is happening and fix it).

4. If it isn’t committed, and this is a bug, can I just close PGAdmin4
and/or PG and discard the changes that way?

5. Is this a new, different bug?

6. What was that 'one row effected' about?

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Melvin Davidson 2016-11-29 18:24:22 Re: ROLLBACK syntax error in pgadmin4
Previous Message Kieran McCusker 2016-11-29 10:38:19 PgAdmin4 not usable when installed from RPMs on Fedora linux