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 CC779329CDB for ; Wed, 15 Sep 2004 03:38:51 +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 20182-10 for ; Wed, 15 Sep 2004 02:38:39 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id B91D6329C65 for ; Wed, 15 Sep 2004 03:38:40 +0100 (BST) Received: (qmail 12891 invoked by uid 1112); 15 Sep 2004 02:38:36 -0000 Date: Tue, 14 Sep 2004 21:38:36 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Oliver Jowett Cc: Tim Penhey , pgsql-jdbc@postgresql.org Subject: Re: Problem with dollar-quoted CREATE OR REPLACE FUNCTION In-Reply-To: <41477610.8070202@opencloud.com> Message-ID: References: <41470089.8010207@penhey.net> <41477610.8070202@opencloud.com> 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/65 X-Sequence-Number: 10955 On Wed, 15 Sep 2004, Oliver Jowett wrote: > Kris Jurka wrote: > > > 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 > > It's a pity the grammar doesn't let you specify the function body as a > parameter, then you could just use a PreparedStatement and avoid the > quoting problems altogether.. Yes and no. The problem with that approach is that you have to know what you're doing ahead of time instead of just blindly passing a query string into Statement.execute(). Consider an admin interface (or say psql) written in java, it should be able to take an arbitrary sql string and run it without problem. This is just another case of the driver not correctly lexing/parsing a query. Also note that the current code does not correctly handle single quotes that are escaped with backslashes. Kris Jurka