Issue Details (XML | Word | Printable)

Key: DERBY-1894
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Yip Ng
Reporter: Yip Ng
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

SQLSTATE 42X10 occurs when qualifying a column with a synonym in ORDER BY clause

Created: 27/Sep/06 08:29 PM   Updated: 13/Dec/07 09:05 AM
Return to search
Component/s: SQL
Affects Version/s: 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4
Fix Version/s: 10.1.3.2, 10.2.2.0, 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works derby1894-trunk-diff01.txt 2006-09-28 10:59 PM Yip Ng 12 kB
Text File Licensed for inclusion in ASF works derby1894-trunk-diff02.txt 2006-10-02 06:37 PM Yip Ng 12 kB
Text File Licensed for inclusion in ASF works derby1894-trunk-stat01.txt 2006-09-28 10:59 PM Yip Ng 0.3 kB
Text File Licensed for inclusion in ASF works derby1894-trunk-stat02.txt 2006-10-02 06:37 PM Yip Ng 0.3 kB
Environment: Any

Issue & fix info: Patch Available
Resolution Date: 06/Oct/06 04:56 PM


 Description  « Hide
SQLSTATE 42X10 occurs when qualifying a column with a synonym in ORDER BY clause, where the synonym was declared in a different schema:

ij version 10.3
ij> connect 'jdbc:derby:wombat;create=true';
ij> create schema test1;
0 rows inserted/updated/deleted
ij> create schema test2;
0 rows inserted/updated/deleted
ij> create table test1.testtable(id bigint not null);
0 rows inserted/updated/deleted
ij> create synonym test2.testtable for test1.testtable;
0 rows inserted/updated/deleted
ij> set schema test1;
0 rows inserted/updated/deleted
ij> select testtable.id from testtable;
ID
--------------------

0 rows selected
ij> set schema test2;
0 rows inserted/updated/deleted
ij> select testtable.id from testtable;
ID
--------------------

0 rows selected
ij> select testtable.id from testtable order by testtable.id;
ERROR 42X10: 'TESTTABLE' is not an exposed table name in the scope in which it appears.
ij>

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #452259 Mon Oct 02 23:23:04 UTC 2006 mikem DERBY-1894
contributed by Yip Ng
patch: derby1894-trunk-diff02.txt

The fix is in FromBaseTable's getFromTableByName() method, where it is using
the resolved synonym table name to do the binding for ORDER BY column.
Patch includes additional tests.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out

Repository Revision Date User Message
ASF #452269 Mon Oct 02 23:57:18 UTC 2006 mikem DERBY-1894
contributed by Yip Ng
merging from trunk to 10.1 branch.

The fix is in FromBaseTable's getFromTableByName() method, where it is using
the resolved synonym table name to do the binding for ORDER BY column.
Patch includes additional tests.
Files Changed
MODIFY /db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out

Repository Revision Date User Message
ASF #453306 Thu Oct 05 18:24:19 UTC 2006 mikem DERBY-1894
contributed by Yip Ng
merging from trunk to 10.2 branch.

The fix is in FromBaseTable's getFromTableByName() method, where it is using
the resolved synonym table name to do the binding for ORDER BY column.
Patch includes additional tests.
Files Changed
MODIFY /db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out