db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r584249 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
Date Fri, 12 Oct 2007 19:54:47 GMT
Author: dag
Date: Fri Oct 12 12:54:13 2007
New Revision: 584249

URL: http://svn.apache.org/viewvc?rev=584249&view=rev
Log:
DERBY-3013 column-definition WITH DEFAULT should accept CURRENT_USER, SESSION_USER in addition
to USER

Patch DERBY-3013.

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=584249&r1=584248&r2=584249&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Fri Oct
12 12:54:13 2007
@@ -10590,11 +10590,12 @@
 						getContextManager());
 	}
 |
-	<USER>
+	/* Revert DB2 restriction: DERBY-3013. Accept standard SQL CURRENT_USER,
+	 * SESSION_USER in addition to USER.
+	 */
+	value = userNode()
 	{
-		return (ValueNode) nodeFactory.getNode(
-								C_NodeTypes.USER_NODE,
-								getContextManager());
+		return value;
 	}
 |
 	LOOKAHEAD({

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out?rev=584249&r1=584248&r2=584249&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/columnDefaults.out
Fri Oct 12 12:54:13 2007
@@ -202,7 +202,32 @@
 A          |B          
 -----------------------
 4          |0          
-ij> -- clean up
+ij> -- begin DERBY-3013
+create table tabWithUserAndSchemaDefaults(
+             cUser           CHAR(8) default user,
+             cCurrent_user   CHAR(8) default current_user,
+             cSession_user   CHAR(8) default session_user,
+             cCurrent_schema CHAR(128) default current schema);
+0 rows inserted/updated/deleted
+ij> -- Should work
+insert into tabWithUserAndSchemaDefaults values (default, default, default, default);
+1 row inserted/updated/deleted
+ij> select * from tabWithUserAndSchemaDefaults;
+CUSER   |CCURREN&|CSESSIO&|CCURRENT_SCHEMA                                      
                                                                          
+-----------------------------------------------------------------------------------------------------------------------------------------------------------
+APP     |APP     |APP     |APP                                                          
                                                                  
+ij> -- Should fail:
+create table tabWithUserDefaultTooNarrowColumn(
+       c1 CHAR(7) default user);
+ERROR 42894: DEFAULT value or IDENTITY attribute value is not valid for column 'C1'.
+ij> -- Should fail:
+create table tabWithSchemaDefaultTooNarrowColumn(
+       c1 CHAR(127) default current sqlid);
+ERROR 42894: DEFAULT value or IDENTITY attribute value is not valid for column 'C1'.
+ij> drop table tabWithUserAndSchemaDefaults;
+0 rows inserted/updated/deleted
+ij> -- end DERBY-3013
+-- clean up
 drop function asdf;
 0 rows inserted/updated/deleted
 ij> drop table t1;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql?rev=584249&r1=584248&r2=584249&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/columnDefaults.sql
Fri Oct 12 12:54:13 2007
@@ -125,6 +125,28 @@
 insert into t_331 values (4, default);
 select * from t_331;
 
+-- begin DERBY-3013
+create table tabWithUserAndSchemaDefaults(
+             cUser           CHAR(8) default user,
+             cCurrent_user   CHAR(8) default current_user,
+             cSession_user   CHAR(8) default session_user,
+             cCurrent_schema CHAR(128) default current schema);                 
+             
+-- Should work
+insert into tabWithUserAndSchemaDefaults values (default, default, default, default);
+select * from tabWithUserAndSchemaDefaults;
+
+-- Should fail:
+create table tabWithUserDefaultTooNarrowColumn(
+       c1 CHAR(7) default user);
+
+-- Should fail:
+create table tabWithSchemaDefaultTooNarrowColumn(
+       c1 CHAR(127) default current sqlid);
+
+drop table tabWithUserAndSchemaDefaults;
+-- end DERBY-3013
+
 -- clean up
 drop function asdf;
 drop table t1;



Mime
View raw message