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] Commented: (DERBY-2457) Use of column aliases in group by / having clauses can cause queries to fail
Date Thu, 08 May 2008 14:06:55 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595246#action_12595246
] 

Dag H. Wanvik commented on DERBY-2457:
--------------------------------------

> It appears that, while ORDER BY items are bound to the select's
> result column list, GROUP BY and HAVING items are bound to
> the select's "from list". 
>
> So one approach might be to change GroupByColumn.bindExpression
> and similar places to be more like OrderByColumn.bindOrderByColumn;
> that is, to bind against the select RCL, rather than against the from list.

This seems to be intentional, cf. this comment:

http://issues.apache.org/jira/browse/DERBY-84?focusedCommentId=66872#action_66872
(Klebanoff 02/Jun/05 05:23 PM):
"My reading of the SQL2003 spec indicates that the Derby behavior
follows the SQL standard. See the standard's discussion of identifier
chains. The spec differentiates between identifiers used in ORDER BY
clauses and identifiers used elsewhere. The spec says that (column)
identifiers in a ORDER BY clause should be bound to the column names
defined in the select list, but that other (column) identifiers should
be bound to columns in tables in the FROM list."

I did not check the standard yet.

> Use of column aliases in group by / having clauses can cause queries to fail
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-2457
>                 URL: https://issues.apache.org/jira/browse/DERBY-2457
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.3.1.4
>            Reporter: Andrew McIntyre
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: 1624_repro.sql
>
>
> Some use of column aliases in group by / having clauses can cause queries to fail with
error 42X04. The queries can sometimes be made to work by also aliasing the table or rewriting
the query to use a subselect. Attached is a simple sql script which reproduces the issue,
originally found as part of DERBY-1624.

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


Mime
View raw message