You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org> on 2005/02/15 22:33:45 UTC

[jira] Created: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

ERROR 42X79 not consistant ? - same column name specified twice
---------------------------------------------------------------

         Key: DERBY-147
         URL: http://issues.apache.org/jira/browse/DERBY-147
     Project: Derby
        Type: Bug
    Reporter: Bernd Ruehlicke


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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by Army <qo...@sbcglobal.net>.
> Hi,
> 
> Don't know why the system was coded to throw exception for duplicate
> columns but it seems like it has been around in Cloudscape from very
> beginning.

I only looked at this briefly, so please don't take this as the final word or anything--but here's one reason why we 
might want to throw an error:

// This is fine.
ij> select i, (i * -1) as i from t1;
I          |I
-----------------------
2          |-2
4          |-4
8          |-8

// But this...???
ij> select i, (i * -1) as i from t1 ORDER BY i;

Which column is the result set going to be ordered by?  Is it better to just pick one and go with it, or is it better to 
throw a duplicate column exception?

Just a thought,
Army


Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by Mamta Satoor <ms...@gmail.com>.
On Mon, 28 Feb 2005 19:57:59 +0100 (CET), Bernd Ruehlicke (JIRA)
<de...@db.apache.org> wrote:
>     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59875 ]
> 
> Bernd Ruehlicke commented on DERBY-147:
> ---------------------------------------
> 
> Ok I made the changes and build Derby - and tested it - seams to work.
> 
> We may consider to make this change permanent.
> 
> Any reason for this error log was added ?
> 
> Here the code snipled (need to chnage getOrderBy(String, String) and getOrderBy(String, String, int)
> 
> ...
>                        if (columnName.equals( resultColumn.getName()) )
>                        {
>                                if (retVal == null)
>                                {
>                                        retVal = resultColumn;
>                                }
> //      DERBY-147                               else if (index < size - orderBySelect)
> //      DERBY-147                               {
> //      DERBY-147                                       throw StandardException.newException(SQLState.LANG_DUPLICATE_COLUMN_FOR_ORDER_BY, columnName);
> //      DERBY-147                               }
>                                else
>                                {// remove the column due to pullup of orderby item
>                                        removeElement(resultColumn);
>                                        decOrderBySelect();
>                                        break;
>                                }
>                        }
> ...
> 

Hi,

Don't know why the system was coded to throw exception for duplicate
columns but it seems like it has been around in Cloudscape from very
beginning.

Mamta

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59875 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

Ok I made the changes and build Derby - and tested it - seams to work.

We may consider to make this change permanent. 

Any reason for this error log was added ?

Here the code snipled (need to chnage getOrderBy(String, String) and getOrderBy(String, String, int)

...
			if (columnName.equals( resultColumn.getName()) )
			{
				if (retVal == null)
				{
					retVal = resultColumn;
				}
//	DERBY-147				else if (index < size - orderBySelect)
//	DERBY-147				{
//	DERBY-147					throw StandardException.newException(SQLState.LANG_DUPLICATE_COLUMN_FOR_ORDER_BY, columnName);
//	DERBY-147				}
				else
				{// remove the column due to pullup of orderby item
					removeElement(resultColumn);
					decOrderBySelect();
					break;
				}
			}
...


By the way - if already at the code - and since the code is more or less the same  would be handy to refactor the getOrderBy(String, String) to 

getOrderBy(String, String)
{
   return getOrderBy(String, String, null);
}

and handle "null" in the String, String, int method.


B-)

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422761 ] 
            
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

OK got it perfectly working now. 

I also refactored the getOrderByColumn(String, TableName) to call the getOrderByColumn(String, TableName, int) instead of double the code. (See code below)

After I have figured out why the source is distorted when I check it out with svn I will apply the diff and make a patch. (That's I guess is why my fist patch had so many spaces ...)


ij>  select col1, col2, col1 from t order by col1;
COL1       |COL2      |COL1
----------------------------------
1          |one       |1
2          |two       |2
3          |three     |3

3 rows selected
ij>  select col1, col2, col1 from t order by col1, col2;
COL1       |COL2      |COL1
----------------------------------
1          |one       |1
2          |two       |2
3          |three     |3

3 rows selected
ij>  select col1, col2, col1, col1, col1, col2, col2 from t order by col1;
COL1       |COL2      |COL1       |COL1       |COL1       |COL2      |COL2
--------------------------------------------------------------------------------
1          |one       |1          |1          |1          |one       |one
2          |two       |2          |2          |2          |two       |two
3          |three     |3          |3          |3          |three     |three

3 rows selected



Codechange in  ./engine/org/apache/derby/impl/sql/compile/ResultColumnList.java


        /**
         * For order by, get a ResultColumn that matches the specified
         * columnName 
         *
         * @param columnName	The ResultColumn to get from the list
         * @param tableName	The table name on the OrderByColumn, if any
         * @param tableNumber	The tableNumber corresponding to the FromTable with the
         *			exposed name of tableName, if tableName != null.
         *
         * @return	the column that matches that name.
         */
        public ResultColumn getOrderByColumn(String columnName, TableName tableName, int tableNumber)
        throws StandardException
        {
            int size = size();
            ResultColumn retVal = null, resultColumn;
            
            for (int index = 0; index < size; index++)
            {
                resultColumn = (ResultColumn) elementAt(index);
                
                /* The order by column is qualified, then it is okay to consider
                 * this RC if:
                 *	o  The RC is qualified and the qualifiers on the order by column
                 *	   and the RC are equal().
                 *	o  The RC is not qualified, but its expression is a ColumnReference
                 *	   from the same table (as determined by the tableNumbers).
                 */
                if (tableName != null)
                {
                    ValueNode rcExpr = resultColumn.getExpression();
                    if (rcExpr == null || !(rcExpr instanceof ColumnReference))
                        continue;
                    
                    ColumnReference cr = (ColumnReference) rcExpr;
                    if( (! tableName.equals( cr.getTableNameNode())) && tableNumber != cr.getTableNumber())
                        continue;
                }
                
                /* We finally got past the qualifiers, now see if the column
                 * names are equal.
                 */
                if (columnName.equals( resultColumn.getName()) )
                {
                    if (retVal == null)
                    {
                        retVal = resultColumn;
                    }
                    else if (index >= size - orderBySelect)
                    {// remove the column due to pullup of orderby item
                        removeElement(resultColumn);
                        decOrderBySelect();
                        break;
                    }
                }
            }
            return retVal;
        }


	/**
	 * For order by, get a ResultColumn that matches the specified 
	 * columnName
	 *
	 * @param columnName	The ResultColumn to get from the list
	 * @param tableName	The table name on the OrderByColumn, if any
	 *
	 * @return	the column that matches that name.
	 */
	public ResultColumn getOrderByColumn(String columnName, TableName tableName)
		throws StandardException
	{
            return getOrderByColumn(columnName, tableName, -1);
	}





> 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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422745 ] 
            
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

Simple question:

Is most of the source checked in from Linux /Unix ? It seems to me when I checout the code it gets reformatted.

Here how part of the code of ./engine/org/apache/derby/impl/sql/compile/ResultColumnList.java  looks like just after checkout (not touched by my IDE yet)

Any special standart who files are suppose to be checked in ? Aka Windows Ascii format or Unix  ?



	/**
	 * For order by, get a ResultColumn that matches the specified 
	 * columnName and ensure that there is only one match before the bind process.
	 *
	 * @param columnName	The ResultColumn to get from the list
	 * @param tableName	The table name on the OrderByColumn, if any
	 *
	 * @return	the column that matches that name.
	 * @exception StandardException thrown on duplicate
	 */
	public ResultColumn getOrderByColumn(String columnName, TableName tableName)
		throws StandardException
	{
		int				size = size();
		ResultColumn	retVal = null, resultColumn;

		for (int index = 0; index < size; index++)
		{
			resultColumn = (ResultColumn) elementAt(index);

			// We may be checking on "ORDER BY T.A" against "SELECT *".
			// exposedName will not be null and "*" will not have an expression
			// or tablename.
			// We may be checking on "ORDER BY T.A" against "SELECT T.B, T.A".
			if (tableName != null)
			{
				ValueNode rcExpr = resultColumn.getExpression();
				if (rcExpr == null || ! (rcExpr instanceof ColumnReference))
                {
                    continue;
                }
				ColumnReference cr = (ColumnReference) rcExpr;
                if( ! tableName.equals( cr.getTableNameNode()))
                    continue;
			}

			/* We finally got past the qualifiers, now see if the column
			 * names are equal.
			 */




> 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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Rick Post (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59231 ]
     
Rick Post commented on DERBY-147:
---------------------------------

I tested a similar query on Oracle9i rel 2 and Oracle accepts this syntax and returns an ordered result set.

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Mike Matrigali (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=all ]

Mike Matrigali updated DERBY-147:
---------------------------------

      Component: SQL
    Description: 
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.



  was:
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.



    Environment: 

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         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


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422647 ] 
            
Kathey Marsden commented on DERBY-147:
--------------------------------------

Hi  Bernd,

When you resubmit your patch,  please 
1) Assign yourself
2) Mark the patch available checkbox.  (which probably didn't exist when you originally submitted your patch)
3)  Ping the list if you don't get a response after a week.

I thought we were doing bad with a 3 and 4 month turnaround  on independent contributor patches but at *16 months*, this one certainly takes the prize.
There has been discussion about mailing the patch list to the developer list and being more attentive to patches and hopefully we will get that under control, but  meanwhile there is a lot you can do streamline your  own patch and drive it to commit.  Please take a look at:
http://wiki.apache.org/db-derby/PatchAdvice

Thanks for all your patience.

Kathey


> 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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422715 ] 
            
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

Thanx a lot !!  I have to admit I did not watch this myselfe for a while [I was happy with my fix until I wanted to update Derby] - so my mistake.

Thanx for the feedback Knut, you are 100% correct. Let me play with this for a while and see If I can make this happen. 

Kathey - thanx for the link to the PatchAdvice - I was looking for something like that.

I have checked out the 10.1 branch and will work on that.

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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61514 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

OK - found
http://incubator.apache.org/derby/derby_comm.html#Contribute+Code+or+Documentation

That should do it.



> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by Jack Klebanoff <kl...@sbcglobal.net>.
It is not so simple. The order by specification may be ambiguous. Derby 
allows the following:
  select t.c1 as a, t.c2 as a from t
What should we do if you add "order by a" to the above select? "a" is 
truly ambiguous.

I can think of several alternatives:
1. Prohibit duplicate select list column names, whether or not there is 
an order by clause.
2. Change ORDER BY processing. When it finds an ambiguous column name 
check whether all the columns with that name are really the same. Allow 
the ORDER BY if so. Remember that Tomohito Nakayama is working on 
allowing general expressions in the ORDER BY clause, so this is not so easy.
3. Change ORDER BY processing. When it finds an ambiguous column name 
check whether the sort key names a column in an underlying table (not a 
correlation name). Allow the ORDER BY if so. Throw an SQLException if 
not, even if all the possible columns have the same value. This fixes 
the case in the bug report.
4. Keep the error checking as is but improve the error message. 
Something like "ORDER BY column 'xx' is ambiguous".
5. Do nothing.

Jack Klebanoff
Diljeet Dhillon (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61483 ]
>     
>Diljeet Dhillon commented on DERBY-147:
>---------------------------------------
>
>Hi,
>Have we established whether a possible patch/fix will be provided for this issue. and what the possible timescales may be?
>
>
> 
>
>  
>
>>ERROR 42X79 not consistant ? - same column name specified twice
>>---------------------------------------------------------------
>>
>>         Key: DERBY-147
>>         URL: http://issues.apache.org/jira/browse/DERBY-147
>>     Project: Derby
>>        Type: Bug
>>    Reporter: Bernd Ruehlicke
>>    
>>
>
>  
>
>>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.
>>    
>>
>
>  
>


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Diljeet Dhillon (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61483 ]
     
Diljeet Dhillon commented on DERBY-147:
---------------------------------------

Hi,
Have we established whether a possible patch/fix will be provided for this issue. and what the possible timescales may be?


 

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by Shreyas Kaushik <Sh...@Sun.COM>.
Hi Bernd,

http://incubator.apache.org/derby/derby_downloads.html#How+to+test+Derby

http://incubator.apache.org/derby/derby_comm.html#Contribute+Code+or+Documentation

I above links have some info you are looking for.

thanks
Shreyas

Bernd Ruehlicke (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61494 ]
>     
>Bernd Ruehlicke commented on DERBY-147:
>---------------------------------------
>
>I fixed it as Satheesh suggested. I have tested it in our location and it seams to work. 
>I have not have time to
>
>1) Write Tests
>2) Figure out how to check it into the trunk 
>
>I would like to work on this asap - it would help with just a few "dummy" steps how and from where to check out the file, check it back in. And where teh JUnit tests should be checked into.
>
>Bernd 
>
>  
>
>>ERROR 42X79 not consistant ? - same column name specified twice
>>---------------------------------------------------------------
>>
>>         Key: DERBY-147
>>         URL: http://issues.apache.org/jira/browse/DERBY-147
>>     Project: Derby
>>        Type: Bug
>>    Reporter: Bernd Ruehlicke
>>    
>>
>
>  
>
>>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.
>>    
>>
>
>  
>

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61494 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

I fixed it as Satheesh suggested. I have tested it in our location and it seams to work. 
I have not have time to

1) Write Tests
2) Figure out how to check it into the trunk 

I would like to work on this asap - it would help with just a few "dummy" steps how and from where to check out the file, check it back in. And where teh JUnit tests should be checked into.

Bernd 

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422627 ] 
            
Knut Anders Hatlen commented on DERBY-147:
------------------------------------------

Hi Bernd,

Thank you for providing the patch. I'm sorry no one has picked it up
yet. I had a brief look at it, and I have a couple of comments:

 * Most of the changes in the patch are white-space changes. This makes
   it harder for reviewers to understand what parts of the code have
   actually been changed. If you submit a patch that only contains the
   actual changes needed to fix the bug, it is much more likely that
   someone will review it and eventually commit it.

 * With your changes, the javadoc comment for getOrderByColumn()
   becomes outdated. It says "ensure that there is only one match" and
   "@exception StandardException thrown on duplicate". It would be
   good to fix this as well.

 * By removing the else-if clause, the code in the else clause is
   executed instead when you have a duplicate column. This means that
   duplicate columns are removed from the result list, which is not
   correct. I believe a correct fix would have to check that index is
   greater than or equal to (size - orderBySelect) before it calls
   removeElement() and decOrderBySelect(). The example below
   illustrates the problem:

ij> create table t (col1 int, col2 varchar(10));
0 rows inserted/updated/deleted
ij> insert into t values (1, 'one'), (2, 'two'), (3, 'three');
3 rows inserted/updated/deleted
ij> select col1, col2, col1 from t order by col1;
COL1       |COL2      
----------------------
1          |one       
2          |two       
3          |three     

3 rows selected

   COL1 should have occurred twice in the result.

 * It would be really great if the patch had a regression test. It
   doesn't have to be more sophisticated than the query above. It's as
   simple as adding the query to
   java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql
   and updating the master
   java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
   with the expected results.

 * The error message that was removed, is not used anywhere else in
   the code. Therefore, LANG_DUPLICATE_COLUMN_FOR_ORDER_BY could be
   removed from SQLState.java, and the corresponding error message
   could be removed from
   java/engine/org/apache/derby/loc/messages_en.properties.

Thanks,
Knut Anders

> 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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61505 ]
     
Satheesh Bandaram commented on DERBY-147:
-----------------------------------------

Derby uses its own test harness and new tests need to be added with in that framework. Believe Shreyas has provided some pointers. If you need any additional help, or would like me to add the tests for you, I am willing to help.


> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-147:
---------------------------------

    Fix Version/s: 10.2.3.0

Rick merged this into the 10.2 branch with change 448966, not sure what version of 10.2 that was, so just marking it fixed in latest unreleased version of 10.2.

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>                 Key: DERBY-147
>                 URL: https://issues.apache.org/jira/browse/DERBY-147
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Bernd Ruehlicke
>            Assignee: Bryan Pendleton
>             Fix For: 10.2.3.0, 10.3.1.4
>
>         Attachments: derby-147-10.0.2.1.diff, derby-147.diff, patch_with_tests.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.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=all ]

Bryan Pendleton resolved DERBY-147.
-----------------------------------

    Fix Version/s: 10.3.0.0
       Resolution: Fixed
       Derby Info:   (was: [Patch Available])

Committed patch_with_tests.diff to subversion as revision 447877.

Bernd, if you get a chance, please let us know if this resolves
the problem in your environment.

Thanks much to Knut Anders and Satheesh for the reviews and suggestions.

> 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
>         Assigned To: Bryan Pendleton
>             Fix For: 10.3.0.0
>
>         Attachments: derby-147-10.0.2.1.diff, derby-147.diff, patch_with_tests.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

        

[jira] Updated: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=history ]

Bernd Ruehlicke updated DERBY-147:
----------------------------------

    Attachment: derby-147-10.0.2.1.diff

Same fix as applied for the version checked out of the TRUNK, but this is from the 10.0 release branch


> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=all ]

Bryan Pendleton reassigned DERBY-147:
-------------------------------------

    Assignee: Bryan Pendleton

> 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
>         Assigned To: Bryan Pendleton
>         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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12435172 ] 
            
Bryan Pendleton commented on DERBY-147:
---------------------------------------

Hi Bernd,

It is great to hear that you have been successful with this fix in your environment.

Let me see if I can put together a regression test; I think I have enough information to do this,
and then I will combine the regression test with your code changes and we can see about
whether that gives us a suitable patch.

I will also have a look at Satheesh's comment; perhaps it will be not too hard to incorporate
those suggestions.


> 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

        

[jira] Updated: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=history ]

Bernd Ruehlicke updated DERBY-147:
----------------------------------

    Attachment: derby-147.diff

Fixes made from TRUNK revision 158945 (Not for 10.0.2.1 release !!) Fixes applied to java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java

ALL test have been run (derbyall) successfull after this.

No new tests have been added to the harness - Satheesh I hope you can teach me ;-) - I.e. in case you add a test - tell me which and where so I can see howto.

Else I have not understood how to submit a patch to the trunk - I tried different options with svn but do not understand - would be nice with a workflow 

1) How to check out a file - I got that
2) How to change a file - I got that
3) How to commit it back to the trunk - No idea how - or do you need to be "committer" for that ?



> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59923 ]
     
Satheesh Bandaram commented on DERBY-147:
-----------------------------------------

Since you have already made some changes, would it be possible to submit this as a patch? Would also require adding couple of test cases.

Let me know if for any reason you are not able to make the patch. May be I can help in that case.

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by myrna <my...@Golux.Com>.
Bernd Ruehlicke (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59964 ]
>     
>Bernd Ruehlicke commented on DERBY-147:
>---------------------------------------
>
>...ehhh ... got a little lost here. Need some info of procedures of "submitting to the trunk"
>
>Shall I just use svn to submit ? and how ?
>
>Any example of how file  xyz.java  is submitted ?
>
>Sorry - but if I get around those trivial CM issues I can start committing stuff ..
>
>B-)
>
>  
>
Unless you are a committer, you have to submit a patch to the list.
To prepare a patch, you first use svn to add your file to the 
appropriate spot. Best to first sync up...
     - cd <my_derby_loc>/trunk
     - svn update
     - svn add java/engine/impl/yadiyadi/xyz.java
     - svn propset svn:eol-style native java/engine/impl/yadiyadi/xyz.java
     - then you should run the tests (depending on your change, but to 
be safe, deryball)
           - ant all
           - set your CLASSPATH env var to include the trunk/classes dir
           - cd <a temp/test dir>
           -  java 
org.apache.derbyTesting.functionTests.harness.RunSuite derbyall
        after you've resolved any test failures (eg. updated relevant 
../functionTests/master/*.out files)
        you can make the patch.
     - svn diff > xyz.diff
Then, mail the xyz.diff to the list. Indicate which tests you've run.

A committer then will pick up the patch, and by using the 'patch' 
executable apply the deltas from the svn diff file to his/her trunk. 
After running some tests to double check, they will then commit.

Note: there have been cases where certain email systems mess up the 
diffs, specifically with enigmail - that's documented on the derby site 
under contributing with patches...

Myrna


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59964 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

...ehhh ... got a little lost here. Need some info of procedures of "submitting to the trunk"

Shall I just use svn to submit ? and how ?

Any example of how file  xyz.java  is submitted ?

Sorry - but if I get around those trivial CM issues I can start committing stuff ..

B-)

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12435108 ] 
            
Bryan Pendleton commented on DERBY-147:
---------------------------------------

Hi Bernd,

I am interested in this problem too, as it affects one of my applications.

I would like to work with you to get your patch prepared and committed.

What is the current status of the work you're doing on this problem?

Does your current patch address the comments from the reviewers?


> 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

        

[jira] Updated: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=all ]

Bryan Pendleton updated DERBY-147:
----------------------------------

    Attachment: patch_with_tests.diff

Attached is "patch_with_tests.diff", a patch proposal.

I took the work that Bernd did, examined the comments from
the reviewers, and added a bunch of tests. During the testing,
I determined that Satheesh's comment was pretty important, and
that there were actually a number of important ambiguous cases
that we needed to catch. Happily, I discovered that there was already
a method on ResultColumn called "isEquivalent" which appears to
have just the right semantics for distinguishing between cases
where the same column has been selected multiple times, and
cases where completely different columns happen to have the same
column name in the result list.

Note that since we still have to catch and reject ambiguous SELECT
statements, we aren't able to remove the error message and the
SQL state as Knut Anders had hoped we could.

Additionally, I discovered that there were some fairly complicated cases
involving the difference between the "exposed" name of a table and the
base name of the table, which meant that it was problematic to merge
the various getOrderByColumn methods as had been proposed in some
of the earlier patch proposals. Therefore, I reverted to a smaller patch,
which doesn't combine the nearly-redundant versions of getOrderByColumn,
but which preserves the existing behavior in the case of table correlation names.

It took me a while to figure out how "orderBySelect" processing worked, so
I added a comment about that.

The end result is a patch proposal which changes just 4 lines of code; the
rest is comments and tests.

derbyall runs clean, and I added as many new tests as I could think of, so
hopefully I've covered the testing pretty well. Still, I would love to hear
suggestions from reviewers regarding additional tests that could be added.

Please have a look at this patch and let us know your comments.


> 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
>         Assigned To: Bryan Pendleton
>         Attachments: derby-147-10.0.2.1.diff, derby-147.diff, patch_with_tests.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

        

[jira] Updated: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=all ]

Bryan Pendleton updated DERBY-147:
----------------------------------

    Derby Info: [Patch Available]

> 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
>         Assigned To: Bryan Pendleton
>         Attachments: derby-147-10.0.2.1.diff, derby-147.diff, patch_with_tests.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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
    [ 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

        

Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Bernd Ruehlicke (JIRA) wrote:

>      [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59963 ]
>      
> Bernd Ruehlicke commented on DERBY-147:
> ---------------------------------------
> 
> I would like to make that patch. Give me some time to figure out the procedures how to submit such patch. Also I will need to make soem JUnit tests to see if this is actually working in all cases.
> 

While I would love to see Derby use JUnit, it does not do so at the
moment. Any test cases added would need to be added into Derby's test
framework.

I have been experimenting with Junit, but that needs its own thread.

Dan.


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59963 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

I would like to make that patch. Give me some time to figure out the procedures how to submit such patch. Also I will need to make soem JUnit tests to see if this is actually working in all cases.

B-)

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59278 ]
     
Satheesh Bandaram commented on DERBY-147:
-----------------------------------------

I think the query should work too. Fix might be just to remove the error raising code in ResultColumnList.java in routine getOrderByColumn(). Note there are two versions of the function and both could use the same change.

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422749 ] 
            
Satheesh Bandaram commented on DERBY-147:
-----------------------------------------

Last time this patch was reviewed, there was also another concern about truely ambigious columns, like:

Select a+b as x, c+d as x from T order by x

This query should probably raise an error as X in ORDER BY clause is truely ambigious. To make this work, resolution process needs to find out if two different references to X actually correspond to same expression (or column) so that following is allowed:

select a as x, a as x from T order by x
select a, a from T order by a


> 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

        

[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_12422456 ] 
            
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

Is thois one planned to go into 10.2.0.0 ?

I attached the fix and it's really just merge it into the system

Thanx
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

        

Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by myrna <my...@Golux.Com>.
One more comment - maybe superfluous - with svn you 'checkout' a file 
the moment you edit it.

(or to put it more accurately, when you get the files from the trunk 
you've checked them out.
To see the files you've edited/added/deleted, use svn stat, or (to 
ignore any miscellaneous/temporary files: svn stat -q).

You can't check it back in unless you are a derby-committer, so you'll 
have to make a patch & canvass for a committer to evaluate & check in 
your changes.

Myrna

Bernd Ruehlicke (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61512 ]
>     
>Bernd Ruehlicke commented on DERBY-147:
>---------------------------------------
>
>"Shreyas has provided some pointers" .. - ehhh - where do I find them ?  Really - it's just to get started. So a a little example of how to checkout a file and check it back would do it.
>
>Thanx
>Bernd
>
>  
>
>>ERROR 42X79 not consistant ? - same column name specified twice
>>---------------------------------------------------------------
>>
>>         Key: DERBY-147
>>         URL: http://issues.apache.org/jira/browse/DERBY-147
>>     Project: Derby
>>        Type: Bug
>>    Reporter: Bernd Ruehlicke
>>    
>>
>
>  
>
>>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.
>>    
>>
>
>  
>



[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61512 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

"Shreyas has provided some pointers" .. - ehhh - where do I find them ?  Really - it's just to get started. So a a little example of how to checkout a file and check it back would do it.

Thanx
Bernd

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     Reporter: Bernd Ruehlicke

>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Bernd Ruehlicke (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_61646 ]
     
Bernd Ruehlicke commented on DERBY-147:
---------------------------------------

So - how do I make sure this stuff makes it into the 10.1 release ?

> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>          Key: DERBY-147
>          URL: http://issues.apache.org/jira/browse/DERBY-147
>      Project: Derby
>         Type: Bug
>     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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice

Posted by "Diljeet Dhillon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589750#action_12589750 ] 

Diljeet Dhillon commented on DERBY-147:
---------------------------------------

I will be out of the office on the 14/04/08, returning on the 17/04/08.
For any urgent issues, please contact one of my colleagues on ext 5355.

I will however respond to your message when I return.

Regards,

Diljeet Dhillon
The PCMS Group plc,
PCMS House
Torwood Close
Coventry
CV4 8HX

Tel: +44 (0) 24 7669 4455
Fax: +44 (0) 24 7642 1390

Email Address:  diljeet.dhillon@pcmsgroup.com
Corporate Website: - www.pcmsgroup.com

The Architecture Team promoting PCMS Values
~Integrity~Respect~Commitment~Continuous Improvement~

The information contained in this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.  If you are not the intended recipient of this e-mail, the use of this information or any disclosure, copying or distribution is prohibited and may be unlawful.  If you received this in error, please contact the sender and delete the material from any computer.  The views expressed in this e-mail may not necessarily be the views of the PCMS Group plc and should not be taken as authority to carry out any instruction contained.   The PCMS Group reserves the right to monitor and examine the content of all e-mails.

The PCMS Group plc is a company registered in England and Wales with company number 1459419 whose registered office is at PCMS House, Torwood Close, Westwood Business Park, Coventry CV4 8HX, United Kingdom. VAT No: GB 705338743





> ERROR 42X79 not consistant ? - same column name specified twice
> ---------------------------------------------------------------
>
>                 Key: DERBY-147
>                 URL: https://issues.apache.org/jira/browse/DERBY-147
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Bernd Ruehlicke
>            Assignee: Bryan Pendleton
>             Fix For: 10.2.3.0, 10.3.1.4
>
>         Attachments: derby-147-10.0.2.1.diff, derby-147.diff, patch_with_tests.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.
-
You can reply to this email to add a comment to the issue online.