Changeset: 670b9049eb18 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=670b9049eb18
Modified Files:
        sql/test/pg_regress/Tests/random.sql
        sql/test/pg_regress/Tests/random.stable.out
Branch: default
Log Message:

Added ON COMMIT PRESERVE ROWS when creating a temporary table else no dat is 
remembered.
Occasionaly the construction 1.0/rand() would cause a division by zero error.
We do not want that to happen so removed the "1.0/" part.


diffs (91 lines):

diff --git a/sql/test/pg_regress/Tests/random.sql 
b/sql/test/pg_regress/Tests/random.sql
--- a/sql/test/pg_regress/Tests/random.sql
+++ b/sql/test/pg_regress/Tests/random.sql
@@ -7,7 +7,7 @@
 SELECT count(*) FROM onek;
 
 -- pick three random rows, they shouldn't match
--- MonetDB does not allow LIMIT in subqueries
+-- !! MonetDB does not allow ORDER BY or LIMIT in subqueries (and views), so 
disabled this test
 -- (SELECT unique1 AS random
 --   FROM onek ORDER BY random() LIMIT 1)
 -- INTERSECT
@@ -19,31 +19,34 @@ SELECT count(*) FROM onek;
 
 -- count roughly 1/10 of the tuples
 -- this one causes an undetected error
-CREATE TEMPORARY TABLE random_tbl( random double);
+CREATE TEMPORARY TABLE random_tbl( random double)
+ ON COMMIT PRESERVE ROWS;
 
 INSERT INTO random_tbl SELECT count(*) AS random 
   FROM onek WHERE rand() < 1.0/10;
 
 DROP TABLE random_tbl;
 
-CREATE TEMPORARY TABLE random_tbl( random bigint);
+CREATE TEMPORARY TABLE random_tbl( random bigint)
+ ON COMMIT PRESERVE ROWS;
+
 INSERT INTO random_tbl SELECT count(*) AS random 
-  FROM onek WHERE 1.0/rand() < 1.0/10;
+  FROM onek WHERE rand() < 1.0/10;
 
 -- select again, the count should be different
 INSERT INTO RANDOM_TBL (random)
   SELECT count(*)
-  FROM onek WHERE 1.0/rand() < 1.0/10;
+  FROM onek WHERE rand() < 1.0/10;
 
 -- select again, the count should be different
 INSERT INTO RANDOM_TBL (random)
   SELECT count(*)
-  FROM onek WHERE 1.0/rand() < 1.0/10;
+  FROM onek WHERE rand() < 1.0/10;
 
 -- select again, the count should be different
 INSERT INTO RANDOM_TBL (random)
   SELECT count(*)
-  FROM onek WHERE 1.0/rand() < 1.0/10;
+  FROM onek WHERE rand() < 1.0/10;
 
 -- now test that they are different counts
 SELECT random, count(random) FROM RANDOM_TBL
diff --git a/sql/test/pg_regress/Tests/random.stable.out 
b/sql/test/pg_regress/Tests/random.stable.out
--- a/sql/test/pg_regress/Tests/random.stable.out
+++ b/sql/test/pg_regress/Tests/random.stable.out
@@ -35,14 +35,16 @@ Ready.
 % wrd # type
 % 4 # length
 [ 1000 ]
-#CREATE TEMPORARY TABLE random_tbl( random double);
+#CREATE TEMPORARY TABLE random_tbl( random double)
+# ON COMMIT PRESERVE ROWS;
 #INSERT INTO random_tbl SELECT count(*) AS random 
 #  FROM onek WHERE rand() < 1.0/10;
 [ 1    ]
 #DROP TABLE random_tbl;
-#CREATE TEMPORARY TABLE random_tbl( random bigint);
+#CREATE TEMPORARY TABLE random_tbl( random bigint)
+# ON COMMIT PRESERVE ROWS;
 #INSERT INTO random_tbl SELECT count(*) AS random 
-#  FROM onek WHERE 1.0/rand() < 1.0/10;
+#  FROM onek WHERE rand() < 1.0/10;
 [ 1    ]
 #INSERT INTO RANDOM_TBL (random)
 #  SELECT count(*)
@@ -65,12 +67,14 @@ Ready.
 % random,      L1 # name
 % bigint,      wrd # type
 % 1,   1 # length
+[ 0, 4       ]
 #SELECT AVG(random) FROM RANDOM_TBL
 #  HAVING AVG(random) NOT BETWEEN 80 AND 120;
 % .L1 # table_name
 % L1 # name
 % double # type
 % 24 # length
+[ 0  ]
 
 # 12:56:12 >  
 # 12:56:12 >  "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to