From: ml-tb <ml-tb@emagixx.de>
To: pgsql-jdbc@postgresql.org
Subject: Re: Problem with sql ant task
Date: Sat, 3 Sep 2011 15:47:42 +0200
Message-ID: <201109031547.43338.ml-tb@emagixx.de> (raw)
In-Reply-To: <CAOUzaq4010-9gJE2AM=3NokVG1YVw4mYR+PuHBGZMq=A4evNMg@mail.gmail.com>
References: <CAOUzaq4010-9gJE2AM=3NokVG1YVw4mYR+PuHBGZMq=A4evNMg@mail.gmail.com>
Hi,
first: This is not a PostgreSQL or JDBC issue.
some points to remember:
- in ANT the '$' starts a property reference
- functions/triggers/... in JDBC context ist a little bit tricky
for the first point: Have a look at the ANT manual :-).
The second point is implmentation specific. Many Java SQL script
executors splits a scrips in single statments to send them one after
another. But how to detect procedure definition what as one statement?
The procedure langugage is DB specific. No chance for a generic parser.
The solution "Send the whole procedure definition as one statement" does
not work in this environment and especialy not with the ANT task 'sql'.
Bye Thomas
Am Freitag, 2. September 2011 schrieb Alejandra Juarez D'Aquino:
> Hi, I'm new using Posgres and in Ant as well.
> I'm trying to use an ant task (sql) to run ours sql scripts to update
> the database... The test should be re-runnables, so, I was looking
> for a way to do it and I found this
>
> create or replace function execute(TEXT) RETURNS VOID AS $$ BEGIN
> EXECUTE $1; END ;
>
> $$ LANGUAGE plpgsql STRICT;
>
> select execute('create table CLIENTES.TEST (x int4); ') where not
> exsist...;
>
>
>
> but when I try to do something like that
>
>
>
>
> select execute($$'create table CLIENTES.TEST (
> important_field text not null default 's'
> ); '$$);
>
> I am suposed to use $$, however the ant task throws the following
> exception org.postgresql.util.PSQLException: ERROR: error de
> sintaxis en o cerca de «$»
>
>
> Any Idea why is this happening? in pgAdmin it runs ok.
>
>
> Thanks very much...
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: ml-tb@emagixx.de
Subject: Re: Problem with sql ant task
In-Reply-To: <201109031547.43338.ml-tb@emagixx.de>
References: <CAOUzaq4010-9gJE2AM=3NokVG1YVw4mYR+PuHBGZMq=A4evNMg@mail.gmail.com> <201109031547.43338.ml-tb@emagixx.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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