Commit 9e7f3841 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Don't attempt to parse IP/Date(Time) CFs if value is NULL

We pass NULL into the Date/IP parsing logic *before* we get to the check
which says "Oh, are you saying CF.{foo} IS NULL?  Then just left join to
OCFV and be done with it".  This causes warnings and errors in the logs
from trying to parse NULL as a Date or IP.  We did the right thing and
executed the LEFT JOIN anyway, but it caused a lot of noise.
parent 254e6155
......@@ -518,6 +518,31 @@ sub _LimitCustomField {
return %args;
};
# Special Limit (we can exit early)
# IS NULL and IS NOT NULL checks
if ( $op =~ /^IS( NOT)?$/i ) {
my ($ocfvalias, $CFs) = $self->_CustomFieldJoin( $cfkey, $cf, $ltype );
$self->_OpenParen( $args{SUBCLAUSE} );
$self->Limit(
%args,
ALIAS => $ocfvalias,
FIELD => ($column || 'id'),
OPERATOR => $op,
VALUE => $value,
);
# See below for an explanation of this limit
$self->Limit(
ALIAS => $CFs,
FIELD => 'Name',
OPERATOR => 'IS NOT',
VALUE => 'NULL',
ENTRYAGGREGATOR => 'AND',
SUBCLAUSE => $args{SUBCLAUSE},
) if $CFs;
$self->_CloseParen( $args{SUBCLAUSE} );
return;
}
########## Content pre-parsing if we know things about the CF
if ( blessed($cf) and delete $args{PREPARSE} ) {
my $type = $cf->Type;
......@@ -659,29 +684,6 @@ sub _LimitCustomField {
}
########## Limits
# IS NULL and IS NOT NULL checks
if ( $op =~ /^IS( NOT)?$/i ) {
my ($ocfvalias, $CFs) = $self->_CustomFieldJoin( $cfkey, $cf, $ltype );
$self->_OpenParen( $args{SUBCLAUSE} );
$self->Limit(
%args,
ALIAS => $ocfvalias,
FIELD => ($column || 'id'),
OPERATOR => $op,
VALUE => $value,
);
# See below for an explanation of this limit
$self->Limit(
ALIAS => $CFs,
FIELD => 'Name',
OPERATOR => 'IS NOT',
VALUE => 'NULL',
ENTRYAGGREGATOR => 'AND',
SUBCLAUSE => $args{SUBCLAUSE},
) if $CFs;
$self->_CloseParen( $args{SUBCLAUSE} );
return;
}
my $single_value = !blessed($cf) || $cf->SingleValue;
my $negative_op = ($op eq '!=' || $op =~ /\bNOT\b/i);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment