[
https://issues.apache.org/jira/browse/DERBY-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466185
]
Yip Ng commented on DERBY-2218:
-------------------------------
Thanks Army for taking the time to review the patch. I can certainly post a
follow up patch for the additional tests
you added in this jira.
Yes, the resultSet.bindResultColumns(fromList) is called to make sure that the
result column have its type assigned
by the expression. This is what I interpreted from the method name of
resultSet.bindUntypedNullsToResultColumns(null),
which looks to me that the RCL should be resolved before calling this method.
However, it looks like if the RC's type cannot be retrieved from the binding
RC, then it will get it from its expression. So we
may be able to safely remove the extra call to bindResultColumns(). But I'll
rerun derbyall and junit suite to make sure
of that. Will post result here when the regression completes.
> Null Pointer Exception when an untyped NULL subquery ("values null") appears
> outside of the FROM list in a SELECT query.
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-2218
> URL: https://issues.apache.org/jira/browse/DERBY-2218
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.1.3.2, 10.2.2.1, 10.2.3.0, 10.3.0.0
> Reporter: A B
> Assigned To: Yip Ng
> Priority: Minor
> Attachments: derby2218-trunk-diff01.txt, derby2218-trunk-diff02.txt,
> derby2218-trunk-stat01.txt, derby2218-trunk-stat02.txt
>
>
> If a SELECT query contains a subquery which includes an untyped NULL value at
> any place other than in the FROM list, Derby will throw an NPE at bind time.
> ij> create table t1 (i int);
> 0 rows inserted/updated/deleted
> -- If the untyped NULL is in the FROM list, a reasonable error is thrown.
> ij> select * from (values null) x;
> ERROR 42X07: Null is only allowed in a VALUES clause within an INSERT
> statement.
> ij> select * from (select * from t1, (values null) x )y;
> ERROR 42X07: Null is only allowed in a VALUES clause within an INSERT
> statement.
> -- But if it appears anywhere else, the result is an NPE:
> -- IN-list
> ij> select * from t1 where i in (1, 2, (values null));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> -- where clause
> select * from t1 where (values null);
> -- order by clause
> select * from t1 order by (values null);
> -- result column
> select (values null) from t1;
> -- group by clause (only works in 10.2 and later)
> select * from t1 group by (values null);
> -- having clause
> select * from t1 group by i having (values null);
> Stack trace (from 10.2.2) is:
> java.lang.NullPointerException
> at
> org.apache.derby.impl.sql.compile.SubqueryNode.setDataTypeServices(SubqueryNode.java:2289)
> at
> org.apache.derby.impl.sql.compile.SubqueryNode.bindExpression(SubqueryNode.java:529)
> at
> org.apache.derby.impl.sql.compile.ValueNodeList.bindExpression(ValueNodeList.java:130)
> at
> org.apache.derby.impl.sql.compile.BinaryListOperatorNode.bindExpression(BinaryListOperatorNode.java:161)
> at
> org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:540)
> at
> org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(DMLStatementNode.java:249)
> at
> org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:162)
> at
> org.apache.derby.impl.sql.compile.CursorNode.bind(CursorNode.java:253)
> at
> org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:345)
> at
> org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:119)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira