How should one escape regular expressions in plperl?
In the following chunk of PlPerl code the date doesn't match the regex:
my $endby = '2009-06-13';
my $t = spi_exec_query(qq|SELECT CASE WHEN '$endby' ~ E'.*\\d\\d\\d\\d
\\-\\d\\d?\\-\\d\\d?.*'
THEN '$endby'::timestamptz ELSE CURRENT_D
My mistake was using DBD::PgPP (as suggested in "Beginning Databases
with PostgreSQL" by Neil Matthew and Richard stones, Apress) instead
of DBD::Pg.
Thanks for help!
On May 1, 2009, at 4:07 PM, Daniel Verite wrote:
Toomas Vendelin wrote:
I'm writing CGI script
I'm writing CGI scripts in Perl using Postgresql via DBI interface.
RAISE_ERROR is on.
For some reason (unlike with MySQL), when a Perl script dies from
Postgresql error, the line number of Perl script where the error
occurred is not reported, just the SQL statement line number is given.