pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
create function with dollar quoted body
5+ messages / 3 participants
[nested] [flat]

* create function with dollar quoted body
@ 2012-03-09 20:06 Jack Douglas <jack@douglastechnology.co.uk>
  2012-03-10 19:06 ` Re: create function with dollar quoted body Florent Guillaume <fg@nuxeo.com>
  2012-03-10 21:09 ` Re: create function with dollar quoted body Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 2 replies; 5+ messages in thread

From: Jack Douglas @ 2012-03-09 20:06 UTC (permalink / raw)
  To: pgsql-jdbc

I don't know if this is a netbeans problem or a jdbc problem, but when
executing a 'CREATE FUNCTION' script with the body dollar quoted, an
error results.

Reading around this seems to be to do with the script being parsed for
semicolons as line terminators even inside dollar-quoted strings? Or
perhaps not?

Any pointers much appreciated

Thanks
Jack



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: create function with dollar quoted body
  2012-03-09 20:06 create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
@ 2012-03-10 19:06 ` Florent Guillaume <fg@nuxeo.com>
  2012-03-10 19:13   ` Re: create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
  1 sibling, 1 reply; 5+ messages in thread

From: Florent Guillaume @ 2012-03-10 19:06 UTC (permalink / raw)
  To: Jack Douglas <jack@douglastechnology.co.uk>; +Cc: pgsql-jdbc

Hi,

Please give a code example reproducing the problem you see.

Thanks

On Fri, Mar 9, 2012 at 9:06 PM, Jack Douglas
<jack@douglastechnology.co.uk> wrote:
> I don't know if this is a netbeans problem or a jdbc problem, but when
> executing a 'CREATE FUNCTION' script with the body dollar quoted, an
> error results.
>
> Reading around this seems to be to do with the script being parsed for
> semicolons as line terminators even inside dollar-quoted strings? Or
> perhaps not?
>
> Any pointers much appreciated
>
> Thanks
> Jack
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: create function with dollar quoted body
  2012-03-09 20:06 create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
  2012-03-10 19:06 ` Re: create function with dollar quoted body Florent Guillaume <fg@nuxeo.com>
@ 2012-03-10 19:13   ` Jack Douglas <jack@douglastechnology.co.uk>
  2012-03-11 15:08     ` Re: create function with dollar quoted body Florent Guillaume <fg@nuxeo.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Jack Douglas @ 2012-03-10 19:13 UTC (permalink / raw)
  To: pgsql-jdbc

Hi
> Please give a code example reproducing the problem you see.
This works fine:

create or replace function f() returns text language plpgsql as 'begin
return ''A''; end;';

But this fails with "unterminated dollar-quoted string":

create or replace function f() returns text language plpgsql as $$begin
return 'A'; end;$$;

It is not a general problem with dollar-quoting because this works:

create or replace function f() returns text language plpgsql as 'begin
return $$A$$; end;';

Thanks
Jack



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: create function with dollar quoted body
  2012-03-09 20:06 create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
  2012-03-10 19:06 ` Re: create function with dollar quoted body Florent Guillaume <fg@nuxeo.com>
  2012-03-10 19:13   ` Re: create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
@ 2012-03-11 15:08     ` Florent Guillaume <fg@nuxeo.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Florent Guillaume @ 2012-03-11 15:08 UTC (permalink / raw)
  To: Jack Douglas <jack@douglastechnology.co.uk>; +Cc: pgsql-jdbc

Please provide actual Java code.

Florent

On Sat, Mar 10, 2012 at 8:13 PM, Jack Douglas
<jack@douglastechnology.co.uk> wrote:
> Hi
>> Please give a code example reproducing the problem you see.
> This works fine:
>
> create or replace function f() returns text language plpgsql as 'begin
> return ''A''; end;';
>
> But this fails with "unterminated dollar-quoted string":
>
> create or replace function f() returns text language plpgsql as $$begin
> return 'A'; end;$$;
>
> It is not a general problem with dollar-quoting because this works:
>
> create or replace function f() returns text language plpgsql as 'begin
> return $$A$$; end;';
>
> Thanks
> Jack
>


-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: create function with dollar quoted body
  2012-03-09 20:06 create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
@ 2012-03-10 21:09 ` Thomas Kellerer <spam_eater@gmx.net>
  1 sibling, 0 replies; 5+ messages in thread

From: Thomas Kellerer @ 2012-03-10 21:09 UTC (permalink / raw)
  To: pgsql-jdbc

Jack Douglas wrote on 09.03.2012 21:06:
> I don't know if this is a netbeans problem or a jdbc problem, but when
> executing a 'CREATE FUNCTION' script with the body dollar quoted, an
> error results.

It is a NetBeans problem. If the statement is parsed correctly there is no problem creating a function through JDBC

Thomas





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2012-03-11 15:08 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 20:06 create function with dollar quoted body Jack Douglas <jack@douglastechnology.co.uk>
2012-03-10 19:06 ` Florent Guillaume <fg@nuxeo.com>
2012-03-10 19:13   ` Jack Douglas <jack@douglastechnology.co.uk>
2012-03-11 15:08     ` Florent Guillaume <fg@nuxeo.com>
2012-03-10 21:09 ` Thomas Kellerer <spam_eater@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox