Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> On Thu, Sep 11, 2003 at 01:05:47AM +0200, Andreas Pflug wrote:
>
> > A whole script containing any number of valid statements must be
> > executable without interpreting the script.
How is that relevant? It's still parseable with parameter placeholders in
place of literal parameters.
> Yes, but executable by what? You said you are a command liner. Then
> you will probably want to "execute" the script using psql. Then the
> proposed solution is fine, because the \beginliteral and \endliteral
> will be interpreted correctly.
Presumably \beginliteral \endliteral would be psql's way of specifying
parameters to ship over as parameters.
> Now, you also said you wanted to use pgAdmin to administer the database.
> Is it able to execute the complete script, or you have to fiddle around
> with the mouse? If the latter, then there's no point in trying to
> "execute" the script; and I suppose pgAdmin is already capable of taking
> an non-massively-quoted function body and quote it correctly before
> passing the CREATE FUNCTION to the server.
It probably is, but that's not what I was thinking of. I was thinking it
wouldn't have to poke around inside the string at all, it would pass it as an
out-of-band parameter using the new FE protocol.
This helps with DBI too, since you can already do that.
$dbh->do("CREATE FUNCTION foo as ? LANGUAGE SQL", $func);
Is a whole lot cleaner for the front-end to do than trying to quote the
parameters and interpolate them into a query.
--
greg