[
https://issues.apache.org/jira/browse/DERBY-6013?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dag H. Wanvik updated DERBY-6013:
---------------------------------
Urgency: Normal
Affects Version/s: 10.6.1.0
10.6.2.1
10.7.1.1
10.8.1.2
10.8.2.2
10.8.3.0
10.10.1.1
Labels: derby_triage10_11 (was: )
Triaged for 10.11. Wrong back to 10.6 where ORDER BY in subqueries was
introduced.
> Assert failure with ORDER BY in UNION used in sub-query
> -------------------------------------------------------
>
> Key: DERBY-6013
> URL: https://issues.apache.org/jira/browse/DERBY-6013
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.6.1.0, 10.6.2.1, 10.7.1.1, 10.8.1.2, 10.8.2.2,
> 10.8.3.0, 10.9.1.0, 10.10.1.1
> Reporter: Knut Anders Hatlen
> Labels: derby_triage10_11
>
> I see an assert failure when executing this sequence of statements using a
> debug version of 10.9.1.0 or trunk:
> ij version 10.9
> ij> connect 'jdbc:derby:memory:db;create=true';
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> create table u(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values 1,2,3,4,5;
> 5 rows inserted/updated/deleted
> ij> insert into u values 4,5,6,7;
> 4 rows inserted/updated/deleted
> ij> select * from sysibm.sysdummy1 where exists ((select * from t) union
> (select * from u where x = 4) order by x);
> ERROR XJ001: Java exception: 'ASSERT FAILED getMatchingColumn() not expected
> to be called for tableConstructor: false
> all: false
> nestedInParens: false
> correlation Name: null
> null
> tableNumber 3
> level 1
> resultSetNumber: 0
> referencedTableMap: null
> statementResultSet: false
> : org.apache.derby.shared.common.sanity.AssertFailure'.
> Using a non-debug build makes it fail more gracefully:
> ij> select * from sysibm.sysdummy1 where exists ((select * from t) union
> (select * from u where x = 4) order by x);
> ERROR 42X04: Column 'X' is either not in any table in the FROM list or
> appears within a join specification and is outside the scope of the join
> specification or appears in a HAVING clause and is not in the GROUP BY list.
> If this is a CREATE or ALTER TABLE statement then 'X' is not a column in the
> target table.
> However, I think the error message is misleading, as X is a valid column in
> the query. Seen for example by executing the nested query as a top-level
> query:
> ij> (select * from t) union all (select * from u where x = 4) order by x;
> X
> -----------
> 1
> 2
> 3
> 4
> 4
> 5
> 6 rows selected
> However, possibly related, if I simply add parentheses around the working
> query, it again fails with a complaint about the column X:
> ij> ((select * from t) union all (select * from u where x = 4) order by x);
> ERROR 42X78: Column 'X' is not in the result of the query expression.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira