db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-5005) Error when fully qualifying a field from a view in an ORDER BY clause
Date Wed, 09 Feb 2011 00:44:57 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dag H. Wanvik updated DERBY-5005:
---------------------------------

    Attachment: derby-5005.stat
                derby-5005.diff

Uploading a patch that makes the query work. It makes FromSubquery
implement its own getFromTableByName instead of using the abstract
superclass FromTable's implementation which returns null when an
explicit schema is used (a view is represented a FromSubquery here),
cf. the comment in the default implementation:

"Only FromBaseTables have schema names"

which isn't quite true; views can have them, too.

Added a new test, lang.Derby5005Test instead of adding to the harness test
orderby.sql. Made a note in orderby.sql to merge with Derby5005Test
when that test gets rewritten to JUnit.

Running regressions.


> Error when fully qualifying a field from a view in an ORDER BY clause
> ---------------------------------------------------------------------
>
>                 Key: DERBY-5005
>                 URL: https://issues.apache.org/jira/browse/DERBY-5005
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.7.1.1
>         Environment: Windows 7
>            Reporter: Lukas Eder
>            Priority: Minor
>              Labels: order, sql, syntax, views
>         Attachments: 5005.sql, derby-5005.diff, derby-5005.stat
>
>
> I have a strange issue that can be reproduced easily with the following objects in schema
"test":
> create table a (a integer);
> insert into a (a) values(1);
> create view v as select * from a;
> This works:
> select test.a.a from test.a where test.a.a <> 2 order by test.a.a asc;
> This doesn't work:
> select test.v.a from test.v where test.v.a <> 2 order by test.v.a asc;
> But this does:
> select test.v.a from test.v where test.v.a <> 2 order by v.a asc;
> This is the error I get:
> Error: 'TEST.V' is not an exposed table name in the scope in which it appears.
> SQLState:  42X10
> ErrorCode: -1
> I've tried quite a few SELECT clauses, and I think the ORDER BY clause is the only one
having this issue.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message