[
https://issues.apache.org/jira/browse/DERBY-2147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ole Solberg closed DERBY-2147.
------------------------------
> LIKE predicate does not accept a pure column reference as righthand operand
> (gives ERROR 42824)
> -----------------------------------------------------------------------------------------------
>
> Key: DERBY-2147
> URL: https://issues.apache.org/jira/browse/DERBY-2147
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.3.0.0
> Reporter: Ole Solberg
> Assigned To: Bernt M. Johnsen
> Priority: Minor
> Fix For: 10.3.0.0
>
> Attachments: DERBY-2147.diff, DERBY-2147.stat
>
>
> Given "create table t (v varchar(32));" the query "select * from t where
> 'dilldall' like v; " gives ERROR 42824.
> The problem is easily bypassed using a cast: "select * from t where
> 'dilldall' like cast (v as varchar(32));".
> create table t (v varchar(32));
> insert into t values ('%lda%');
> select * from t where 'dilldall' like v; -- ERROR 42824: An operand of LIKE
> is not a string, or the first operand is not a column.
> select * from t where 'dilldall' like cast (v as varchar(32)); -- 1 row. OK
> select * from t where v like 'dilldall'; -- 0 rows - OK, not a pattern as
> right op.
> select * from t where cast (v as varchar(32)) like 'dilldall'; -- 0 rows -
> OK, not a pattern as right op.
> A column reference as a righthand operand should be accepted according to
> ISO/IEC 9075-2:1999 (E):
> 8.5 <like predicate>
> <like predicate> ::=
> <character like predicate> | <octet like predicate>
> <character like predicate> ::=
> <character match value> [ NOT ] LIKE <character pattern> [ ESCAPE <escape
> character> ]
> <character match value> ::= <character value expression>
> <character pattern> ::= <character value expression>
> 6.27 <string value expression>
> <character value expression> ::= <concatenation> | <character factor>
> <character factor> ::= <character primary> [ <collate clause> ]
> <character primary> ::= <value expression primary> | <string value function>
> 6.23 <value expression>
> <value expression primary> ::= <parenthesized value expression> |
> <nonparenthesized value expression primary>
> <nonparenthesized value expression primary> ::= <unsigned value
> specification> | <column reference> | ....
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.