From: | Doug McNaught <doug(at)mcnaught(dot)org> |
---|---|
To: | Jon Jensen <jon(at)endpoint(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: massive quotes? |
Date: | 2003-09-11 02:15:30 |
Message-ID: | m3brtsdq9p.fsf@varsoon.wireboard.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jon Jensen <jon(at)endpoint(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-09-11 03:14:46 | Re: massive quotes? |
Previous Message | Ron Mayer | 2003-09-11 01:15:43 | Re: Broken(?) 'interval' problems. [Was: ISO 8601 "Time Intervals"] |