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 2006/09/08 20:21:43 UTC

svn commit: r441601 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java testing/org/apache/derbyTesting/functionTests/master/functions.out testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql

Author: djd
Date: Fri Sep  8 11:21:43 2006
New Revision: 441601

URL: http://svn.apache.org/viewvc?view=rev&rev=441601
Log:
DERBY-1809 Fix bug where use of builtin functions in the SYSFUN schema within VIEWs would throw an exeception
at CREATE VIEW time. Caused by the AliasDescriptor for such functions reporting they were persistent (had rows
in SYSALIASES) when they are not persistent.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java?view=diff&rev=441601&r1=441600&r2=441601
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java Fri Sep  8 11:21:43 2006
@@ -320,4 +320,13 @@
 	{
 		return specificName;
 	}
+    
+    /**
+     * Functions are persistent unless they are in the SYSFUN schema.
+     *
+     */
+    public boolean isPersistent()
+    {
+        return !getSchemaUUID().toString().equals(SchemaDescriptor.SYSFUN_SCHEMA_UUID);
+    }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out?view=diff&rev=441601&r1=441600&r2=441601
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out Fri Sep  8 11:21:43 2006
@@ -700,6 +700,16 @@
 NULL    
 0.836   
 ERROR 22003: The resulting value is outside the range for the data type DOUBLE.
+ij> CREATE VIEW VSMT AS SELECT SIN(d) sd, PI() pi FROM SYSFUN_MATH_TEST;
+0 rows inserted/updated/deleted
+ij> select cast (sd as DECIMAL(6,3)), cast (pi as DECIMAL(6,3)) from VSMT;
+1       |2       
+-----------------
+NULL    |3.141   
+0.620   |3.141   
+0.973   |3.141   
+ij> drop view VSMT;
+0 rows inserted/updated/deleted
 ij> drop table SYSFUN_MATH_TEST;
 0 rows inserted/updated/deleted
 ij> drop function SYSFUN.ACOS;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql?view=diff&rev=441601&r1=441600&r2=441601
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql Fri Sep  8 11:21:43 2006
@@ -303,6 +303,10 @@
 
 select cast (SYSFUN.ACOS(d) as DECIMAL(6,3)) AS SYSFUN_ACOS FROM SYSFUN_MATH_TEST;
 
+CREATE VIEW VSMT AS SELECT SIN(d) sd, PI() pi FROM SYSFUN_MATH_TEST;
+select cast (sd as DECIMAL(6,3)), cast (pi as DECIMAL(6,3)) from VSMT;
+drop view VSMT;
+
 drop table SYSFUN_MATH_TEST;
 
 drop function SYSFUN.ACOS;