db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r209842 - 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/
Date Fri, 08 Jul 2005 16:54:02 GMT
Author: djd
Date: Fri Jul  8 09:54:01 2005
New Revision: 209842

URL: http://svn.apache.org/viewcvs?rev=209842&view=rev
Log:
DERBY-331 This patch fixes a look-ahead problem in the parser: In the method DB2DefaultOption,
the look-ahead for miscBuiltins is too liberal: it mistakenly thinks it has found a
builtin in this case. I made the look-ahead more specific by adding a check against comma.

Contributed by Dag H. Wanvik <Dag.Wanvik@Sun.COM>

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=209842&r1=209841&r2=209842&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
Fri Jul  8 09:54:01 2005
@@ -9657,7 +9657,12 @@
 	}
 |
 	LOOKAHEAD( {getToken(2).kind == LEFT_PAREN ||
-				getToken(4).kind == LEFT_PAREN})
+		       (getToken(4).kind == LEFT_PAREN && 
+		        getToken(2).kind != COMMA)} ) 
+		// Check against comma: see Derby-331 
+		// Before adding this, the following was erroneously
+		// flagged as invalid: 
+		//	   create table foo(.., b int default 0, unique (a))
 	value = miscBuiltins()
 	{
 		// If we have a function (as indicated by an open paren,

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out?rev=209842&r1=209841&r2=209842&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
Fri Jul  8 09:54:01 2005
@@ -175,6 +175,17 @@
 C1         
 -----------
 10         
+ij> -- JIRA issue Derby-331
+create table t_331 (a int not null, b int default 0, unique (a));
+0 rows inserted/updated/deleted
+ij> insert into t_331 values (4, default);
+1 row inserted/updated/deleted
+ij> insert into t_331 values (4, default);
+ERROR 23505: The statement was aborted because it would have caused a duplicate key value
in a unique or primary key constraint or unique index identified by 'xxxxGENERATED-IDxxxx'
defined on 'T_331'.
+ij> select * from t_331;
+A          |B          
+-----------------------
+4          |0          
 ij> -- clean up
 drop function asdf;
 0 rows inserted/updated/deleted
@@ -187,5 +198,7 @@
 ij> drop table "otherschema"."y1";
 0 rows inserted/updated/deleted
 ij> drop schema "otherschema" restrict;
+0 rows inserted/updated/deleted
+ij> drop table t_331;
 0 rows inserted/updated/deleted
 ij> 

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql?rev=209842&r1=209841&r2=209842&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
Fri Jul  8 09:54:01 2005
@@ -103,6 +103,12 @@
 insert into t7 values (default);
 select * from t7;
 
+-- JIRA issue Derby-331
+create table t_331 (a int not null, b int default 0, unique (a));
+insert into t_331 values (4, default);
+insert into t_331 values (4, default);
+select * from t_331;
+
 -- clean up
 drop function asdf;
 drop table t1;
@@ -110,3 +116,5 @@
 drop table "x1";
 drop table "otherschema"."y1";
 drop schema "otherschema" restrict;
+drop table t_331;
+



Mime
View raw message