db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@sourcery.org>
Subject Re: [jira] Commented: (DERBY-147) ERROR 42X79 not consistant ? - same column name specified twice
Date Fri, 11 Mar 2005 22:08:08 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Bernd,<br>
<br>
Just following up to check how your patch making is comming along. You
already have the code change and you wanted to attempt to make a patch.
Let me know if you are stuck or need more assistance.<br>
<br>
If changing test suites to add test cases seem daunting, let me know.
For this case, I am willing to work with you to add required testing
support.<br>
<br>
Satheesh<br>
<br>
Bernd Ruehlicke (JIRA) wrote:
<blockquote
 cite="mid765658090.1109617079650.JavaMail.jira@ajax.apache.org"
 type="cite">
  <pre wrap="">     [ <a class="moz-txt-link-freetext" href="http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59875">http://issues.apache.org/jira/browse/DERBY-147?page=comments#action_59875</a>
]
     
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 &lt; 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-)

  </pre>
  <blockquote type="cite">
    <pre wrap="">ERROR 42X79 not consistant ? - same column name specified twice
---------------------------------------------------------------

         Key: DERBY-147
         URL: <a class="moz-txt-link-freetext" href="http://issues.apache.org/jira/browse/DERBY-147">http://issues.apache.org/jira/browse/DERBY-147</a>
     Project: Derby
        Type: Bug
    Reporter: Bernd Ruehlicke
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">This happens from JDBC or ij. Here the output form ij&gt;
ij version 10.0 
CONNECTION0* - 	jdbc:derby:phsDB 
* = current connection 
ij&gt; 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&gt; 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&gt; 
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.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
<br>
</body>
</html>


Mime
View raw message