Re: ROLLBACK syntax error in pgadmin4
От | Melvin Davidson |
---|---|
Тема | Re: ROLLBACK syntax error in pgadmin4 |
Дата | |
Msg-id | 1624998339.3350088.1480443862050@mail.yahoo.com обсуждение исходный текст |
Ответ на | ROLLBACK syntax error in pgadmin4 (Malik Rumi <malik.a.rumi@gmail.com>) |
Ответы |
Re: ROLLBACK syntax error in pgadmin4
(Malik Rumi <malik.a.rumi@gmail.com>)
|
Список | pgadmin-support |
<div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:16px"><divid="yui_3_16_0_1_1480442930679_8438"><b>The problem is, ROLLBACK requires a transaction. Soto use it properly you need to <br /></b></div><div dir="ltr" id="yui_3_16_0_1_1480442930679_8400"><b>start with a BEGINstatement.</b></div><div id="yui_3_16_0_1_1480442930679_8439"><b><br /></b></div><div id="yui_3_16_0_1_1480442930679_8387"><b>eg:</b></div><divid="yui_3_16_0_1_1480442930679_8399"><b><br /></b></div><div id="yui_3_16_0_1_1480442930679_8375"><b>BEGIN;</b></div><divid="yui_3_16_0_1_1480442930679_8347"><b id="yui_3_16_0_1_1480442930679_8847">your_statements;</b></div><divid="yui_3_16_0_1_1480442930679_8363"><b>ROLLBACK;<br /></b></div><divid="yui_3_16_0_1_1480442930679_8313"><b><span><br /></span></b></div><div id="yui_3_16_0_1_1480442930679_8630"><bid="yui_3_16_0_1_1480442930679_8848"><a class="edited-link-editor" href="https://www.postgresql.org/docs/9.4/static/sql-begin.html" id="yui_3_16_0_1_1480442930679_8631">https://www.postgresql.org/docs/9.4/static/sql-begin.html<br/></a></b></div><div id="yui_3_16_0_1_1480442930679_8629"><b><br/></b></div><div id="yui_3_16_0_1_1480442930679_8850"><b id="yui_3_16_0_1_1480442930679_8849"><aclass="edited-link-editor" href="https://www.postgresql.org/docs/9.4/static/sql-rollback.html" id="yui_3_16_0_1_1480442930679_8786">https://www.postgresql.org/docs/9.4/static/sql-rollback.html</a></b></div><div dir="ltr"id="yui_3_16_0_1_1480442930679_8851"><b><a class="edited-link-editor" href="https://www.postgresql.org/docs/9.4/static/sql-rollback.html"id="yui_3_16_0_1_1480442930679_8786"><br /></a></b></div><divid="yui_3_16_0_1_1480442930679_8314"><div dir="ltr" id="yui_3_16_0_1_1480442930679_8853"><b id="yui_3_16_0_1_1480442930679_8852">fyi,in the future, it is always a good idea to include the PostgreSQL version.</b></div><divdir="ltr" id="yui_3_16_0_1_1480442930679_8854"><b><br /></b></div></div><div class="signature" id="yui_3_16_0_1_1480442930679_8318"><divid="RTEContent"><font id="yui_3_16_0_1_1480442930679_8502" size="4"><span id="yui_3_16_0_1_1480442930679_8501"style="font-weight:bold;font-family:arial;color:rgb(0, 0, 255);">Melvin Davidson </span></font><br/><font id="yui_3_16_0_1_1480442930679_8671" size="3"> Cell 720-320-0155 <br /></font><font id="yui_3_16_0_1_1480442930679_8441"size="3" style="font-weight:bold;"><span id="yui_3_16_0_1_1480442930679_8440" style="color:rgb(128,0, 255);">I reserve the right to fantasize. Whether or not you </span><br style="color:rgb(128, 0,255);" /><span id="yui_3_16_0_1_1480442930679_8457" style="color:rgb(128, 0, 255);">wish to share my fantasy is entirelyup to you. </span><img data-id="2504534e-ab70-de15-417b-22733bd23caa" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/01.gif"style="color:rgb(128, 0, 255);" /><br /></font><font id="yui_3_16_0_ym19_1_1467319472979_3360"size="3" style="font-weight:bold;">www.youtube.com/unusedhero/videos<br /></font><fontid="yui_3_16_0_1_1480442930679_8670" size="3"><span id="yui_3_16_0_1_1480442930679_8669" style="font-weight:bold;font-family:courier;">FolkAlley - All Folk - 24 Hours a day </span><span id="yui_3_16_0_1_1480442930679_8673"style="font-weight:bold;font-family:courier;"><br />www.folkalley.com<br /><br /></span></font></div></div><divclass="qtdSeparateBR" id="yui_3_16_0_1_1480442930679_8442"><br /><br /></div><div class="yahoo_quoted"id="yui_3_16_0_1_1480442930679_8446" style="display: block;"><div id="yui_3_16_0_1_1480442930679_8445"style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 16px;"><divid="yui_3_16_0_1_1480442930679_8444" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, LucidaGrande, sans-serif; font-size: 16px;"><div dir="ltr" id="yui_3_16_0_1_1480442930679_8503"><font face="Arial" id="yui_3_16_0_1_1480442930679_8674"size="2"><hr size="1" /><b><span style="font-weight:bold;">From:</span></b> Malik Rumi<malik.a.rumi@gmail.com><br /><b><span style="font-weight: bold;">To:</span></b> pgAdmin Support <pgadmin-support@postgresql.org><br /><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, November 29, 20161:17 PM<br /><b><span style="font-weight: bold;">Subject:</span></b> [pgadmin-support] ROLLBACK syntax error in pgadmin4<br/></font></div><div class="y_msg_container" id="yui_3_16_0_1_1480442930679_8443"><br /><div id="yiv6295819857"><divdir="ltr" id="yui_3_16_0_1_1480442930679_8447">I am using PGAdmin4 with PG 9.4 on Ubuntu 16.04 64bit. I wanted to do an update, but was unsure of the result, so I unselected autocommit and ran explain. It said only onerow was affected, which I didn’t understand, because it should have affected at least 2. Then I inferred that the ‘onerow’ being referred to was the plan, not the rows in my data. <div class="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;"></div><divclass="yiv6295819857gmail-western" id="yui_3_16_0_1_1480442930679_8448"style="margin-bottom:0in;line-height:100%;">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:</div><divclass="yiv6295819857gmail-western" id="yui_3_16_0_1_1480442930679_8449" style="margin-bottom:0in;line-height:100%;margin-left:40px;">ERROR:syntax error at or near "ROLLBACK" LINE 1: ...de" SETchildof_id = NULL WHERE codelevelsortseq=1 ROLLBACK;</div><div class="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;">Ithen did a new query, with just ROLLBACK; as I see it explained with an examplein the docs: <a href="https://www.postgresql.org/docs/9.4/static/sql-rollback.html" rel="nofollow" target="_blank">https://www.postgresql.org/docs/9.4/static/sql-rollback.html</a></div><div class="yiv6295819857gmail-western"id="yui_3_16_0_1_1480442930679_8451" style="margin-bottom:0in;line-height:100%;">Nevertheless,I got the same error:</div><div class="yiv6295819857gmail-western"style="margin-bottom:0in;line-height:100%;margin-left:40px;">ERROR: syntax error at ornear "ROLLBACK" LINE 1: ...F, VERBOSE ON, COSTS ON, BUFFERS OFF, TIMING OFF) ROLLBACK;</div><br />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 beenrun in the interim. <div class="yiv6295819857gmail-western" id="yui_3_16_0_1_1480442930679_8455" style="margin-bottom:0in;line-height:100%;">Tomy surprise, there are very few Google hits for this exact search: </div><divclass="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;margin-left:40px;">"syntax error ator near 'ROLLBACK'" About 30 results (0.34 seconds) </div><div class="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;">Thefirst two hits are for a bug report from Nov. of 2006, which was fixed thenand there. I don’t think this is the same bug, if it is a bug. </div><div class="yiv6295819857gmail-western" id="yui_3_16_0_1_1480442930679_8453"style="margin-bottom:0in;line-height:100%;">I did find DISCARD in the docs: <a href="https://www.postgresql.org/docs/9.4/static/sql-discard.html"rel="nofollow" target="_blank">https://www.postgresql.org/docs/9.4/static/sql-discard.html</a>however, I have not run it because I wantedsome clarity here and didn’t want to interfere with my ROLLBACK, if it would even have that effect.</div><div class="yiv6295819857gmail-western"style="margin-bottom:0in;line-height:100%;">So, my questions:</div><div class="yiv6295819857gmail-western"style="margin-bottom:0in;line-height:100%;">1. How do I discard this update and get mydata back?</div><div class="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;">2. How do I check tomake sure it really isn’t committed without upsetting my ROLLBACK options? (Yes, I do have a backup I can go to, but Iwould rather understand what is happening and fix it).</div><div class="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;">4.If it isn’t committed, and this is a bug, can I just close PGAdmin4 and/orPG and discard the changes that way?</div><div class="yiv6295819857gmail-western" style="margin-bottom:0in;line-height:100%;">5.Is this a new, different bug?</div><div class="yiv6295819857gmail-western"style="margin-bottom:0in;line-height:100%;">6. What was that 'one row effected' about?<br/></div></div></div><br /><br /></div></div></div></div></div>
В списке pgadmin-support по дате отправления: