Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4F7519FB1DF for ; Tue, 28 Nov 2006 10:17:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 14540-07 for ; Tue, 28 Nov 2006 10:17:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 8E1E59FB1C4 for ; Tue, 28 Nov 2006 10:17:11 -0400 (AST) Received: (qmail 3372 invoked from network); 28 Nov 2006 14:17:09 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.14?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 28 Nov 2006 14:17:09 -0000 In-Reply-To: <456C41F0.8000909@lsd.di.uminho.pt> References: <456C41F0.8000909@lsd.di.uminho.pt> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6E9AED86-5035-4756-AB39-51A916F952B9@fastcrypt.com> Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: PLPG Date: Tue, 28 Nov 2006 09:17:24 -0500 To: alfranio correia junior X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/160 X-Sequence-Number: 16202 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 >