Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 35834
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: KES [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Cannot mix placeholder styles ":foo" and "?"
DBD::Pg BUG: select (ARRAY[ 1,2,3,4,5 ])[2:4], 'a'::text, ?::int Cannot mix placeholder styles ":foo" and "?" at C:/Perl/site/lib/DBD/Pg.pm line 225
On Tue May 13 06:29:18 2008, KES wrote: Show quoted text
> DBD::Pg BUG: select (ARRAY[ 1,2,3,4,5 ])[2:4], 'a'::text, ?::int > Cannot mix placeholder styles ":foo" and "?" at > C:/Perl/site/lib/DBD/Pg.pm line 225
Try this: $dbh->{pg_placeholder_dollaronly} = 1; $SQL = 'SELECT (ARRAY[1,2])[1:2], $1::int'; # note single quotes $dbh->selectall_arrayref($SQL); The pg_placeholder_dollaronly was designed for cases like this in which the query contains ? and : which are used as non-placeholders. While it's possible to improve DBD::Pg's internal parser to correctly read statements like the example above, there are more complex cases than the one you gave that would be very difficult to parse, so it's far easier for us (and safer for the user) to simply use pg_placeholder_dollaronly and stick to "dollarsign" placeholders.