[ 
http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12435170 ] 
            
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

Hi Bryan,

I checked out 10.1.3.2 and applied the code changes in my latest comment above 
(NOT the original patch I have attached.) This code change solves the problem 
and adresses the very true concern from Knut (thanx again Knut), but not the 
problem mentioned by Satheesh. But still - better than it is currently ! I 
rebuild Derby and all works wonderful now.

Honestly I got lost in the regression test and in the checkout of the code 
since it more or less distoreted the file and when I made a diff more or less 
all showed to be different.. Anyhow I tried to add some tests in orderby.sql 
and orderby.out but could not get it to work. Now I have a deadline and cannot 
use much time on this.

I made some JUnit tests in my application using this and it seems to work 
pretty well. Note also I simplified the "getOrderByColumn(String columnName, 
TableName tableName) " method simply by calling the other,

So - even if the example from Satheesh is a problem we could at least checkin 
the code changes above which will get most of us going and than add the 
situation mentioned by Satheesh as a new issue to be fixed in future releases.  

Bernd

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>                 Key: DERBY-147
>                 URL: http://issues.apache.org/jira/browse/DERBY-147
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Bernd Ruehlicke
>         Attachments: derby-147-10.0.2.1.diff, derby-147.diff
>
>
> This happens from JDBC or ij. Here the output form ij>
> ij version 10.0 
> CONNECTION0* -        jdbc:derby:phsDB 
> * = current connection 
> ij> select a1.XXX_foreign, a1.native, a1.kind, a1.XXX_foreign FROM 
> slg_name_lookup a1 ORDER BY a1.XXX_foreign;
> ERROR 42X79: Column name 'XXX_FOREIGN' appears more than once in the result 
> of the query expression. 
> But when removing the ORDER BY and keeping the 2 same column names it works
> ij> select a1.XXX_foreign, a1.native, a1.kind, a1.XXX_foreign FROM 
> slg_name_lookup a1;
> XXX_FOREIGN                                                                   
>   |NATIVE                                                                     
>      |KIND                                    |XXX_FOREIGN                    
>                                                   
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>   
> 0 rows selected 
> ij> 
> So - it seams to be OK to specify the same column twice - as long as you do 
> not add the ORDER BY clause.  
> I woul dof course like that the system allows this - but at leats it should 
> be consistant and either allow both or none of the two queries above.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to