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 ??