Re: massive quotes? - Mailing list pgsql-hackers

From Doug McNaught
Subject Re: massive quotes?
Date
Msg-id m3brtsdq9p.fsf@varsoon.wireboard.com
Whole thread Raw
In response to Re: massive quotes?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: massive quotes?
List pgsql-hackers
Jon Jensen <jon@endpoint.com> writes:

> On Wed, 10 Sep 2003, Alvaro Herrera wrote:
> 
> > On Wed, Sep 10, 2003 at 10:35:18PM +0200, Andreas Pflug wrote:
> > 
> > > I never agreed that a client solution would be satisfying. While 
> > > frontends might try to hide some uglyness of the syntax to the user for 
> > > single functions, editing large scripts with many functions is still 
> > > suffering from "massive quotes".
> > 
> > Oh, and you will be feeding those script to the backend through what?
> 
> I don't know what he'd be using, but I use Perl/DBI for things like that. 
> Sure, I could spawn psql instances, but it's a lot less efficient and is 
> quite different from using DBI directly.

But Perl/DBI does escaping for you, so all you'd have to do is:

$sth = $dbh->prepare  ("CREATE FUNCTION foo(x text) RETURNS text AS ? LANGUAGE 'plpgsql'");
$sth->execute($function_body);

where $function_body is the unescaped form of the function.  So
there's no need for a COPY-style mechanism, you can use the current
CREATE FUNCTION syntax without having to escape everything yourself.
The same argument applies to JDBC.

-Doug


pgsql-hackers by date:

Previous
From: "Ron Mayer"
Date:
Subject: Re: Broken(?) 'interval' problems. [Was: ISO 8601 "Time Intervals"]
Next
From: Tom Lane
Date:
Subject: Re: massive quotes?