Subject: | Placeholders are not recognized in plpgsql block |
DBD-Pg-3.6.0
DBI-1.636
This is perl 5, version 24, subversion 0 (v5.24.0) built for MSWin32-x86-multi-thread-64int
Windows Xp SP3
Next script fails with
'Statement has no placeholders to bind at E:\ph-bugreport.pl line 20.'
----------------------------------------------------------
#!/usr/bin/perl
use strict;
use DBI;
my $dbh = DBI->connect('DBI:Pg:dbname=db_name;host=192.168.0.2;port=5432','user','passwd', {PrintError => 1, RaiseError => 0, AutoCommit => 0});
my $stmt = q(
do language plpgsql
$$
begin
insert into msg_sended values (?);
exception
when unique_violation then
update msg_sended set sended_tg=true where msg_id=?;
end;
$$;
);
$dbh->{RaiseError} = 1;
my $sth = $dbh->prepare($stmt);
$sth->bind_param(1, 12345);
$sth->bind_param(2, 12345);
my $rows = $sth->execute();
$dbh->commit;
---------------------------------------------------------
Without placeholders all works.
$dbh->prepare($stmt,{pg_server_prepare => 1}) doesn't help.