X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D355329C82 for ; Tue, 14 Sep 2004 19:53:08 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90010-06 for ; Tue, 14 Sep 2004 18:52:58 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id B1CBC329CDB for ; Tue, 14 Sep 2004 19:52:53 +0100 (BST) Received: (qmail 8157 invoked by uid 1112); 14 Sep 2004 18:47:03 -0000 Date: Tue, 14 Sep 2004 13:47:03 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Tim Penhey Cc: pgsql-jdbc@postgresql.org Subject: Re: Problem with dollar-quoted CREATE OR REPLACE FUNCTION In-Reply-To: <41470089.8010207@penhey.net> Message-ID: References: <41470089.8010207@penhey.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/62 X-Sequence-Number: 10952 On Tue, 14 Sep 2004, Tim Penhey wrote: > Hi All, > > I am currently using the beta 2 dev 3 binary for 8.0 on WinXP. > I am using the pgdev.305.jdbc3.jar and eclipse for Java dev. > > I have a CREATE OR REPLACE FUNCTION that uses $BODY$ to start and finish > the body of the function. > When submitting that through jdbc it complains: > > ERROR: unterminated dollar-quoted string at or near "$BODY$ LANGUAGE > 'plpgsql'" > The problem is that the jdbc driver does not have any knowledge of dollar quoting. It is trying to split your statement on semi colons and send each piece separately. That is something like "SELECT 1; SELECT 2" would be sent as two individual queries by the driver. The driver needs to do the splitting to use the V3 extended query protocol. Your options seem to be: - don't use dollar quoting - use the 7.4 driver which doesn't try to split queries - teach the driver about dollar quoting Making the driver aware of dollar quoting is clearly the best (and hardest) option. Kris Jurka