You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Daniel John Debrunner (JIRA)" <ji...@apache.org> on 2007/06/13 00:27:25 UTC
[jira] Created: (DERBY-2809) Expressions with a parameter can be
assigned the incorrect type
Expressions with a parameter can be assigned the incorrect type
---------------------------------------------------------------
Key: DERBY-2809
URL: https://issues.apache.org/jira/browse/DERBY-2809
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.3.0.0
Reporter: Daniel John Debrunner
Assignee: Daniel John Debrunner
Some unary operator nodes with a parameter can be assigned incorrect types during bind time, for example SQRT(?) can become a BOOLEAN expression.
This statement compiles successfully when it should be rejected as SQRT() is not a boolean function.
ij> values case when sqrt(?) then 3 else 4 end;
ERROR 07000: At least one parameter to the current statement is uninitialized.
When a constant is used the correct binding happens.
ij> values case when sqrt(9.0) then 3 else 4 end;
ERROR 42X88: A conditional has a non-Boolean operand. The operand of a conditional must evaluate to TRUE, FALSE, or UNKNOWN.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2809) Expressions with a parameter can be
assigned the incorrect type
Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504031 ]
Daniel John Debrunner commented on DERBY-2809:
----------------------------------------------
I believe the logic for handling ValueNode.requiresTypeFromContext() is incorrect for unary nodes, especially for UnaryArithmeticOperatorNode.
Its setType() method passes on the type to subsequent nodes without checking if requiresTypeFromContext() is true for any of the nodes, that seems to permissive, or assuming facts about its caller sequence which may not be true.
UnaryOperatorNode also has a requiresTypeFromContext() that can return true if its operand requires its type from the context. However
this is only true for a limited number of cases, I think only unary + and -, so it would seem to make more sense for only UnaryArithmeticOperatorNode to override the method, rather than all nodes that are UnaryOperatorNode sub-classes.
> Expressions with a parameter can be assigned the incorrect type
> ---------------------------------------------------------------
>
> Key: DERBY-2809
> URL: https://issues.apache.org/jira/browse/DERBY-2809
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.3.0.0
> Reporter: Daniel John Debrunner
> Assignee: Daniel John Debrunner
>
> Some unary operator nodes with a parameter can be assigned incorrect types during bind time, for example SQRT(?) can become a BOOLEAN expression.
> This statement compiles successfully when it should be rejected as SQRT() is not a boolean function.
> ij> values case when sqrt(?) then 3 else 4 end;
> ERROR 07000: At least one parameter to the current statement is uninitialized.
> When a constant is used the correct binding happens.
> ij> values case when sqrt(9.0) then 3 else 4 end;
> ERROR 42X88: A conditional has a non-Boolean operand. The operand of a conditional must evaluate to TRUE, FALSE, or UNKNOWN.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-2809) Expressions with a parameter can be
assigned the incorrect type
Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel John Debrunner updated DERBY-2809:
-----------------------------------------
Fix Version/s: 10.4.0.0
10.3.1.1
Fixed in trunk (10.4) last revision is: Committed revision 551764.
Will backport to 10.3
> Expressions with a parameter can be assigned the incorrect type
> ---------------------------------------------------------------
>
> Key: DERBY-2809
> URL: https://issues.apache.org/jira/browse/DERBY-2809
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.3.0.0
> Reporter: Daniel John Debrunner
> Assignee: Daniel John Debrunner
> Fix For: 10.3.1.1, 10.4.0.0
>
>
> Some unary operator nodes with a parameter can be assigned incorrect types during bind time, for example SQRT(?) can become a BOOLEAN expression.
> This statement compiles successfully when it should be rejected as SQRT() is not a boolean function.
> ij> values case when sqrt(?) then 3 else 4 end;
> ERROR 07000: At least one parameter to the current statement is uninitialized.
> When a constant is used the correct binding happens.
> ij> values case when sqrt(9.0) then 3 else 4 end;
> ERROR 42X88: A conditional has a non-Boolean operand. The operand of a conditional must evaluate to TRUE, FALSE, or UNKNOWN.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-2809) Expressions with a parameter can be
assigned the incorrect type
Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel John Debrunner closed DERBY-2809.
----------------------------------------
Resolution: Fixed
Fixed, changes merged into 10.3, tests added.
> Expressions with a parameter can be assigned the incorrect type
> ---------------------------------------------------------------
>
> Key: DERBY-2809
> URL: https://issues.apache.org/jira/browse/DERBY-2809
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.3.0.0
> Reporter: Daniel John Debrunner
> Assignee: Daniel John Debrunner
> Fix For: 10.3.1.1, 10.4.0.0
>
>
> Some unary operator nodes with a parameter can be assigned incorrect types during bind time, for example SQRT(?) can become a BOOLEAN expression.
> This statement compiles successfully when it should be rejected as SQRT() is not a boolean function.
> ij> values case when sqrt(?) then 3 else 4 end;
> ERROR 07000: At least one parameter to the current statement is uninitialized.
> When a constant is used the correct binding happens.
> ij> values case when sqrt(9.0) then 3 else 4 end;
> ERROR 42X88: A conditional has a non-Boolean operand. The operand of a conditional must evaluate to TRUE, FALSE, or UNKNOWN.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.