Changeset: fe0299d68197 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe0299d68197
Modified Files:
sql/test/pg_regress/Tests/timestamp.sql
sql/test/pg_regress/Tests/timestamptz.sql
Branch: Apr2019
Log Message:
Make test timestamp test deterministic too.
diffs (75 lines):
diff --git a/sql/test/pg_regress/Tests/timestamp.sql
b/sql/test/pg_regress/Tests/timestamp.sql
--- a/sql/test/pg_regress/Tests/timestamp.sql
+++ b/sql/test/pg_regress/Tests/timestamp.sql
@@ -5,6 +5,13 @@
/* SET australian_timezones = 'off'; */
CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) );
+DECLARE test_now timestamp(2);
+DECLARE test_current_timestamp timestamp(2);
+DECLARE test_current_date date;
+
+SET test_now = now;
+SET test_current_timestamp = current_timestamp;
+SET test_current_date = current_date;
-- Shorthand values
-- Not directly usable for regression testing since these are not constants.
@@ -13,31 +20,31 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestam
-- statements.
--INSERT INTO TIMESTAMP_TBL VALUES ('now');
-INSERT INTO TIMESTAMP_TBL VALUES (now);
+INSERT INTO TIMESTAMP_TBL VALUES (test_now);
--INSERT INTO TIMESTAMP_TBL VALUES ('current');
-INSERT INTO TIMESTAMP_TBL VALUES (cast(current_timestamp as timestamp));
+INSERT INTO TIMESTAMP_TBL VALUES (cast(test_current_timestamp as timestamp));
--INSERT INTO TIMESTAMP_TBL VALUES ('today');
-INSERT INTO TIMESTAMP_TBL VALUES (cast(current_date as timestamp));
+INSERT INTO TIMESTAMP_TBL VALUES (cast(test_current_date as timestamp));
--INSERT INTO TIMESTAMP_TBL VALUES ('yesterday');
-INSERT INTO TIMESTAMP_TBL VALUES (cast(sql_sub(current_date, 24*60*60.0) as
timestamp));
+INSERT INTO TIMESTAMP_TBL VALUES (cast(sql_sub(test_current_date, 24*60*60.0)
as timestamp));
--INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow');
-INSERT INTO TIMESTAMP_TBL VALUES (cast(sql_add(current_date, 24*60*60.0) as
timestamp));
+INSERT INTO TIMESTAMP_TBL VALUES (cast(sql_add(test_current_date, 24*60*60.0)
as timestamp));
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow EST');
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow zulu');
--SELECT d1 FROM TIMESTAMP_TBL;
-SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = cast(current_date as
timestamp);
-SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 =
cast(sql_add(current_date, 24*60*60.0) as timestamp);
-SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 =
cast(sql_sub(current_date, 24*60*60.0) as timestamp);
-SELECT count(*) AS None FROM TIMESTAMP_TBL WHERE d1 = cast(now as timestamp);
+SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = cast(test_current_date as
timestamp);
+SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 =
cast(sql_add(test_current_date, 24*60*60.0) as timestamp);
+SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 =
cast(sql_sub(test_current_date, 24*60*60.0) as timestamp);
+SELECT count(*) AS None FROM TIMESTAMP_TBL WHERE d1 = cast(test_now as
timestamp);
DELETE FROM TIMESTAMP_TBL;
-- verify uniform transaction time within transaction block
START TRANSACTION;
-INSERT INTO TIMESTAMP_TBL VALUES (now);
-INSERT INTO TIMESTAMP_TBL VALUES (now());
-SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 <= cast(now as timestamp);
+INSERT INTO TIMESTAMP_TBL VALUES (test_now);
+INSERT INTO TIMESTAMP_TBL VALUES (test_now);
+SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 <= cast(test_now as
timestamp);
COMMIT;
DELETE FROM TIMESTAMP_TBL;
diff --git a/sql/test/pg_regress/Tests/timestamptz.sql
b/sql/test/pg_regress/Tests/timestamptz.sql
--- a/sql/test/pg_regress/Tests/timestamptz.sql
+++ b/sql/test/pg_regress/Tests/timestamptz.sql
@@ -36,8 +36,8 @@ DELETE FROM TIMESTAMPTZ_TBL;
-- verify uniform transaction time within transaction block
START TRANSACTION;
-INSERT INTO TIMESTAMPTZ_TBL VALUES (now);
-INSERT INTO TIMESTAMPTZ_TBL VALUES (now());
+INSERT INTO TIMESTAMPTZ_TBL VALUES (test_now);
+INSERT INTO TIMESTAMPTZ_TBL VALUES (test_now);
SELECT count(*) AS two FROM TIMESTAMPTZ_TBL WHERE d1 <= cast(test_now as
timestamptz);
COMMIT;
DELETE FROM TIMESTAMPTZ_TBL;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list