Thread: PgAmin3, Anonymous code block can't be executed by pressing "Execute PG script" button.

<div class="WordSection1"><p class="MsoNormal"><b><i><span style="color:black"></span></i></b><span
style="color:black"> Dearsupport,</span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">Affectedversion: any version.</span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">Distributiontype: any type.</span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">Detectedon OS: Win 7</span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black"> </span><pclass="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">Anonymouscode block can't be executed by pressing "Execute PG script"
button,getting the following error: [ERROR    ] 1.0: syntax error, unexpected character.</span><p
class="MsoNormal"><spanstyle="font-family:"Georgia","serif";color:black"> </span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">Reproduce:</span><pclass="MsoNormal"><span
style="font-family:"Georgia","serif";color:black"> </span><pclass="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">DO$$</span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">BEGIN</span><pclass="MsoNormal"><span
style="font-family:"Georgia","serif";color:black"> insert into tctplugagents values (7, 1, 'aaa', 'aaaa');  </span><p
class="MsoNormal"><spanstyle="font-family:"Georgia","serif";color:black">  EXCEPTION WHEN unique_violation
THEN</span><pclass="MsoNormal"><span style="font-family:"Georgia","serif";color:black">            -- do
nothing</span><pclass="MsoNormal"><span style="font-family:"Georgia","serif";color:black">END$$;--EOS</span><p
class="MsoNormal"><spanstyle="font-family:"Georgia","serif";color:black"> </span><p class="MsoNormal"><span
style="font-family:"Georgia","serif";color:black">Itwill be successfully executed by "execute query" button pressing.
</span><pclass="MsoNormal"><span style="font-family:"Georgia","serif";color:black"> </span><p
class="MsoNormal"><i><spanstyle="font-size:10.0pt;font-family:"Arial","sans-serif";color:#111111">Sincerely
yours</span></i><spanstyle="color:black">,</span><p class="MsoNormal"><span style="color:black"> </span><p
class="MsoNormal"><spanstyle="color:black"><img alt="Description: Celltick logo_highres" height="53"
id="Picture_x0020_1"src="cid:image002.jpg@01CEB2F3.9312C140" width="143" /></span><p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif";color:black">YuriLevinsky, DBA</span><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"></span><pclass="MsoNormal"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif";color:black">CelltickTechnologies Ltd., 32 Maskit St., Herzliya
46733,Israel</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"></span><p
class="MsoNormal"><spanstyle="font-size:8.0pt;font-family:"Arial","sans-serif";color:black">Mobile: +972 54 6107703,
Office:+972 9 9710239; Fax: +972 9 9710222</span><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"></span><pclass="MsoNormal"> </div> 
On Mon, 2013-09-16 at 12:59 +0000, Yuri Levinsky wrote:
>  Dear support,
> Affected version: any version.
> Distribution type: any type.
> Detected on OS: Win 7
> 
> Anonymous code block can't be executed by pressing "Execute PG script" button, getting the following error: [ERROR
]1.0: syntax error, unexpected character.
 
> 
> Reproduce:
> 
> DO $$
> BEGIN
>   insert into tctplugagents values (7, 1, 'aaa', 'aaaa');
>   EXCEPTION WHEN unique_violation THEN
>             -- do nothing
> END$$;--EOS
> 
> It will be successfully executed by "execute query" button pressing.
> 

pgscript was written previous to the inclusion of the DO statement in
PostgreSQL. Since then, there's been not much work on the pgScript tool.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com