Skip Menu |

This queue is for tickets about the SQL-Abstract CPAN distribution.

Report information
The Basics
Id: 93946
Status: rejected
Priority: 0/
Queue: SQL-Abstract

People
Owner: Nobody in particular
Requestors: rlang [...] me.com
Cc:
AdminCc:

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



Subject: "convert" command seems to break for boolean columns
Date: Mon, 17 Mar 2014 12:16:18 -0700
To: bug-SQL-Abstract [...] rt.cpan.org
From: Ryan Lang <rlang [...] me.com>
I’m running version 1.77 with Postgres 9.2.2, and seem to have come across an issue with the convert method. If my where clause includes a -bool/-not_bool value, set like the following: my %where = ( -not_bool => ‘traded’ ); and I’m also using “convert=>’upper’”, then SQL::Abstract generates the following sql: …WHERE NOT upper(“traded")… This is improper SQL in Postgres: "function upper(boolean) does not exist”. Looking under the hood (Line 645ish), it seems like whenever the column name is a scalar value, it will still do the convert function. Is this desired behavior? Thanks for looking this over, Ryan
By design "convert" is a very blunt instrument, and is applied to all operands. It's not SQL::Abstract's job to know which functions can be applied to which columns and types. Excepting -(not_)bool from this would be inconsistent, and break things in confusing manners for users who specify a conversion fucntion that does accept booleans. You'd get a similar error if you tried to do { int_column => 42 } with a convert function that doesn't take integers.