db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Nielsen (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-3066) WHERE clause not accepted on derived expression columns
Date Tue, 11 Sep 2007 07:53:32 GMT
WHERE clause not accepted on derived expression columns

                 Key: DERBY-3066
                 URL: https://issues.apache.org/jira/browse/DERBY-3066
             Project: Derby
          Issue Type: Improvement
          Components: SQL
            Reporter: Thomas Nielsen
            Priority: Minor

A very simple query involving an expression column with a derived name in the WHERE clause

ij> select a+b as s from t where s > 2;
ERROR 42X04: Column 'S' 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 'S' is
not a column in the target table.

Noticed this while working on DERBY-2998, and AFAIK this is a valid query and a limitation
in derby.

There is a workaround for this using a nested select (output from a test table):
ij> select * from (select a+b as s from t) as t(s) where s > 2;

3 rows selected

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message