pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: alfranio correia junior <alfranio@lsd.di.uminho.pt>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PLPG
Date: Tue, 28 Nov 2006 09:17:24 -0500
Message-ID: <6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com> (raw)
In-Reply-To: <456C41F0.8000909@lsd.di.uminho.pt>
References: <456C41F0.8000909@lsd.di.uminho.pt>

handling dollar quoted functions is a recent addition to the driver.

You should probably build the driver from source if you really need it.

Dave
On 28-Nov-06, at 9:04 AM, alfranio correia junior wrote:

> How do I create a PLPG procedure by means of a statement ?
> For instance:
>
> private static String createFunction = "CREATE OR REPLACE FUNCTION  
> process_audit_customer() RETURNS TRIGGER AS \n"
> 			+ "$process_audit$ \n"
> 			+ "BEGIN \n"
> 			+ "IF (TG_OP = 'DELETE') THEN \n"
> 			+ "INSERT INTO tmp_customer SELECT OLD.*, 'D', now(), user\\; \n"
> 			+ "RETURN OLD\\; \n"
> 			+ "ELSIF (TG_OP = 'UPDATE') THEN \n"
> 			+ "INSERT INTO tmp_customer SELECT  OLD.*, 'U', now(), user\\; \n"
> 			+ "RETURN NEW\\; \n"
> 			+ "ELSIF (TG_OP = 'INSERT') THEN \n"
> 			+ "INSERT INTO tmp_customer SELECT  NEW.*, 'I', now(), user\\; \n"
> 			+ "RETURN NEW\\; \n"
> 			+ "END IF\\; \n"
> 			+ "RETURN NULL\\; \n"
> 			+ "END\\; \n"
> 			+ "$process_audit$ \n" + "LANGUAGE plpgsql SECURITY DEFINER;";
>
>
> When I try to execute such statement an exception is raised:
>
> ERROR: unterminated dollar-quoted string at or near "$process_audit$
>
> BEGIN
> IF (TG_OP = 'DELETE') THEN
> INSERT INTO tmp_customer SELECT OLD.*, 'D', now(), user
>
>
> Does anybody have a suggestion ?
>
> Regards,
>
> Alfranio.
>
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>




view thread (2+ messages)

Message-ID: <6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com>
Permalink:  ../6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com/
Also on:    postgresql.org/message-id/6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com

 · 

reply

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: pg@fastcrypt.com, alfranio@lsd.di.uminho.pt
  Subject: Re: PLPG
  In-Reply-To: <6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com>
  References: <456C41F0.8000909@lsd.di.uminho.pt> <6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com>

* 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