You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2005/03/15 22:51:55 UTC
svn commit: r157591 - in incubator/derby/code/trunk/java:
engine/org/apache/derby/impl/sql/compile/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/tests/lang/
testing/org/apache/derbyTesting/functionTests/tests/nist/
Author: djd
Date: Tue Mar 15 13:51:52 2005
New Revision: 157591
URL: http://svn.apache.org/viewcvs?view=rev&rev=157591
Log:
Changes for Derby-18 - Exposed name matching has bugs when the column
name is qualified with a schema name.
Contributed by Shreyas Kaushik <Sh...@Sun.COM>
Modified:
incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dml162.out
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/select.out
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/select.sql
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/dml162.sql
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java Tue Mar 15 13:51:52 2005
@@ -305,6 +305,10 @@
columnsTableName = columnReference.getTableNameNode();
+ if(columnsTableName != null)
+ if(columnsTableName.getSchemaName() == null && correlationName == null)
+ columnsTableName.bind(this.getDataDictionary());
+
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(preStmt!=null, "must have prepared statement");
@@ -323,6 +327,10 @@
{
SanityManager.ASSERT(baseTableName!=null,"no name on target table");
}
+
+ if(baseTableName != null)
+ if(baseTableName.getSchemaName() == null && correlationName == null)
+ baseTableName.bind(this.getDataDictionary());
/*
* If the column did not specify a name, or the specified name
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Tue Mar 15 13:51:52 2005
@@ -2445,6 +2445,10 @@
columnsTableName = columnReference.getTableNameNode();
+ if(columnsTableName != null) {
+ if(columnsTableName.getSchemaName() == null && correlationName == null)
+ columnsTableName.bind(this.getDataDictionary());
+ }
/*
** If there is a correlation name, use that instead of the
** table name.
@@ -2458,6 +2462,8 @@
exposedTableName = tableName;
}
+ if(exposedTableName.getSchemaName() == null && correlationName == null)
+ exposedTableName.bind(this.getDataDictionary());
/*
** If the column did not specify a name, or the specified name
** matches the table we're looking at, see whether the column
@@ -3572,6 +3578,13 @@
TableName tn;
tn = super.getTableName();
+
+ if(tn != null) {
+ if(tn.getSchemaName() == null &&
+ correlationName == null)
+ tn.bind(this.getDataDictionary());
+ }
+
return (tn != null ? tn : tableName);
}
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dml162.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dml162.out?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dml162.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dml162.out Tue Mar 15 13:51:52 2005
@@ -18,7 +18,7 @@
CREATE VIEW BLIVET (CITY, PNUM, EMPNUM, EMPNAME, GRADE,
HOURS, PNAME, PTYPE, BUDGET) AS
--0 HU.STAFF NATURAL JOIN HU.WORKS NATURAL JOIN HU.PROJ;
- SELECT PROJ.CITY, HU.PROJ.PNUM, HU.STAFF.EMPNUM, EMPNAME, GRADE, HOURS, PNAME, PTYPE, BUDGET
+ SELECT HU.PROJ.CITY, HU.PROJ.PNUM, HU.STAFF.EMPNUM, EMPNAME, GRADE, HOURS, PNAME, PTYPE, BUDGET
FROM HU.STAFF JOIN HU.WORKS ON (HU.STAFF.EMPNUM=HU.WORKS.EMPNUM) JOIN HU.PROJ ON (HU.PROJ.PNUM=HU.WORKS.PNUM AND HU.PROJ.CITY=HU.STAFF.CITY)
;
0 rows inserted/updated/deleted
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out Tue Mar 15 13:51:52 2005
@@ -460,7 +460,7 @@
ij> select c1 from t1 union select c3 from t3 order by asdf.c3;
ERROR 42877: A qualified column name 'ASDF.C3' is not allowed in the ORDER BY clause.
ij> select c1 from t1 order by sys.t1.c1;
-ERROR 42X10: 'SYS.T1' is not an exposed table name in the scope in which it appears.
+ERROR 42X04: Column 'SYS.T1.C1' is not in any table in the FROM list or it appears within a join specification and is outside the scope of the join specification or it appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SYS.T1.C1' is not a column in the target table.
ij> select c1 from app.t1 order by sys.t1.c1;
ERROR 42X04: Column 'SYS.T1.C1' is not in any table in the FROM list or it appears within a join specification and is outside the scope of the join specification or it appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SYS.T1.C1' is not a column in the target table.
ij> select c1 from t1 c order by app.c.c1;
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/select.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/select.out?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/select.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/select.out Tue Mar 15 13:51:52 2005
@@ -179,4 +179,8 @@
ERROR 42X09: The table or alias name 'APP.S1.T1' is used more than once in the FROM list.
ij> select "S1.T1".d1 from "S1.T1", APP."S1.T1";
ERROR 42X09: The table or alias name 'APP.S1.T1' is used more than once in the FROM list.
+ij> select SYS."S1.T1".d1 from "S1.T1";
+ERROR 42X04: Column 'SYS.S1.T1.D1' is not in any table in the FROM list or it appears within a join specification and is outside the scope of the join specification or it appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SYS.S1.T1.D1' is not a column in the target table.
+ij> select SYS."S1.T1".d1 from "S1.T1" t1;
+ERROR 42X04: Column 'SYS.S1.T1.D1' is not in any table in the FROM list or it appears within a join specification and is outside the scope of the join specification or it appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SYS.S1.T1.D1' is not a column in the target table.
ij>
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/select.sql
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/select.sql?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/select.sql (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/select.sql Tue Mar 15 13:51:52 2005
@@ -121,3 +121,7 @@
select * from "S1.T1" , APP."S1.T1";
select "S1.T1".d1 from "S1.T1", APP."S1.T1";
+
+select SYS."S1.T1".d1 from "S1.T1";
+
+select SYS."S1.T1".d1 from "S1.T1" t1;
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/dml162.sql
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/dml162.sql?view=diff&r1=157590&r2=157591
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/dml162.sql (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/dml162.sql Tue Mar 15 13:51:52 2005
@@ -21,7 +21,7 @@
CREATE VIEW BLIVET (CITY, PNUM, EMPNUM, EMPNAME, GRADE,
HOURS, PNAME, PTYPE, BUDGET) AS
--0 HU.STAFF NATURAL JOIN HU.WORKS NATURAL JOIN HU.PROJ;
- SELECT PROJ.CITY, HU.PROJ.PNUM, HU.STAFF.EMPNUM, EMPNAME, GRADE, HOURS, PNAME, PTYPE, BUDGET
+ SELECT HU.PROJ.CITY, HU.PROJ.PNUM, HU.STAFF.EMPNUM, EMPNAME, GRADE, HOURS, PNAME, PTYPE, BUDGET
FROM HU.STAFF JOIN HU.WORKS ON (HU.STAFF.EMPNUM=HU.WORKS.EMPNUM) JOIN HU.PROJ ON (HU.PROJ.PNUM=HU.WORKS.PNUM AND HU.PROJ.CITY=HU.STAFF.CITY)
;
-- PASS:0863 If view created successfully?