[SearchBuilder-devel] PostgreSQL incompatibility in
DBIx::SearchBuilder::Record
Florian Weimer
fw at deneb.enyo.de
Thu Jul 7 06:52:09 EDT 2005
Here's the relevant excerpt:
sub LoadByCols {
my $self = shift;
my %hash = (@_);
my (@bind, @phrases);
foreach my $key (keys %hash) {
if (defined $hash{$key} && $hash{$key} ne '') {
...
else {
push @phrases, "($key IS NULL OR $key = '')";
}
}
my $QueryString = "SELECT * FROM ".$self->Table." WHERE ".
join(' AND ', @phrases) ;
return ($self->_LoadFromSQL($QueryString, @bind));
}
This means that when an undefined value is passed for a numeric
column, a comparison against '' is inserted into the query, and
PostgreSQL will croak.
Perhaps this piece of code should handle the undefined, empty and
regular case separately.
More information about the SearchBuilder-devel
mailing list