lestrrat has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to create a function (stored procedure) on PostgreSQL using DBI, but I'm hitting a roadblock because DBD::Pg apparently recognizes $1, $2, $3 ... as placeholder variables.
For example, the following code produces an error:
$dbh->do(q{ CREATE FUNCTION poo (INTEGER) RETURNS INTEGER AS $func$ DECLARE val ALIAS FOR $1; BEGIN RETURN val * 2; END }); # Error: DBD::Pg::db do failed: execute called with an unbound placeholder [f +or Statement " CREATE FUNCTION poo (INTEGER) RETURNS INTEGER AS $func$ DECLARE val ALIAS FOR $1; BEGIN RETURN val * 2; END "]
$1 is apparently being recognized as a placeholder, but it's an alias. Is there anyway to circumvent this ??
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::Pg - function declaration and using alias $n
by Thilosophy (Curate) on Feb 15, 2005 at 08:19 UTC | |
by diotalevi (Canon) on Feb 15, 2005 at 21:01 UTC | |
by Thilosophy (Curate) on Feb 16, 2005 at 05:45 UTC | |
by diotalevi (Canon) on Feb 17, 2005 at 22:34 UTC | |
|
Re: DBD::Pg - function declaration and using alias $n
by diotalevi (Canon) on Feb 15, 2005 at 21:04 UTC |