summaryrefslogtreecommitdiff
path: root/src/test/regress/sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-07-29 00:03:19 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-07-29 00:03:19 +0000
commit9c2a7c2269d1ecebd7f83e769bb2640cb82fa0e0 (patch)
treef868b45501a84e01215cefb03754bab63e23730b /src/test/regress/sql
parent2baf4efe09f65d8e8cac32fb882ab9f0fd601574 (diff)
downloadpostgresql-9c2a7c2269d1ecebd7f83e769bb2640cb82fa0e0.tar.gz
Apply (a somewhat revised version of) Greg Mullane's patch to eliminate
heuristic determination of day vs month in date/time input. Add the ability to specify that input is interpreted as yy-mm-dd order (which formerly worked, but only for yy greater than 31). DateStyle's input component now has the preferred spellings DMY, MDY, or YMD; the older keywords European and US are now aliases for the first two of these. Per recent discussions on pgsql-general.
Diffstat (limited to 'src/test/regress/sql')
-rw-r--r--src/test/regress/sql/horology.sql12
-rw-r--r--src/test/regress/sql/timestamp.sql4
-rw-r--r--src/test/regress/sql/timestamptz.sql4
3 files changed, 14 insertions, 6 deletions
diff --git a/src/test/regress/sql/horology.sql b/src/test/regress/sql/horology.sql
index 88ac83b5ad..c9171b28bd 100644
--- a/src/test/regress/sql/horology.sql
+++ b/src/test/regress/sql/horology.sql
@@ -3,7 +3,7 @@
--
-- needed so tests pass even in Australia
SET australian_timezones = 'off';
-SET DateStyle = 'Postgres,US';
+SET DateStyle = 'Postgres, MDY';
--
-- Test various input formats
@@ -20,7 +20,11 @@ SELECT timestamp with time zone '2001-12-27 04:05:06.789-08';
SELECT timestamp with time zone '2001.12.27 04:05:06.789-08';
SELECT timestamp with time zone '2001/12/27 04:05:06.789-08';
SELECT timestamp with time zone '12/27/2001 04:05:06.789-08';
+-- should fail in mdy mode:
SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
+set datestyle to dmy;
+SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
+reset datestyle;
SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789+08';
SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789-08';
SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789+08';
@@ -36,8 +40,8 @@ SELECT timestamp with time zone 'J2452271T040506-08';
SELECT timestamp with time zone 'J2452271T040506.789+08';
SELECT timestamp with time zone 'J2452271T040506.789-08';
-- German/European-style dates with periods as delimiters
-SELECT timestamp with time zone '27.12.2001 04:05:06.789+08';
-SELECT timestamp with time zone '27.12.2001 04:05:06.789-08';
+SELECT timestamp with time zone '12.27.2001 04:05:06.789+08';
+SELECT timestamp with time zone '12.27.2001 04:05:06.789-08';
SET DateStyle = 'German';
SELECT timestamp with time zone '27.12.2001 04:05:06.789+08';
SELECT timestamp with time zone '27.12.2001 04:05:06.789-08';
@@ -53,7 +57,7 @@ SELECT time with time zone 'T040506.789+08';
SELECT time with time zone 'T040506.789-08';
SELECT time with time zone 'T040506.789 +08';
SELECT time with time zone 'T040506.789 -08';
-SET DateStyle = 'Postgres,US';
+SET DateStyle = 'Postgres, MDY';
--
-- date, time arithmetic
diff --git a/src/test/regress/sql/timestamp.sql b/src/test/regress/sql/timestamp.sql
index b08e81e80e..48a9151a70 100644
--- a/src/test/regress/sql/timestamp.sql
+++ b/src/test/regress/sql/timestamp.sql
@@ -80,9 +80,11 @@ INSERT INTO TIMESTAMP_TBL VALUES ('1997-02-10 17:32:01 PST');
INSERT INTO TIMESTAMP_TBL VALUES ('Feb-10-1997 17:32:01 PST');
INSERT INTO TIMESTAMP_TBL VALUES ('02-10-1997 17:32:01 PST');
INSERT INTO TIMESTAMP_TBL VALUES ('19970210 173201 PST');
+set datestyle to ymd;
INSERT INTO TIMESTAMP_TBL VALUES ('97FEB10 5:32:01PM UTC');
INSERT INTO TIMESTAMP_TBL VALUES ('97/02/10 17:32:01 UTC');
-INSERT INTO TIMESTAMP_TBL VALUES ('97.041 17:32:01 UTC');
+reset datestyle;
+INSERT INTO TIMESTAMP_TBL VALUES ('1997.041 17:32:01 UTC');
-- Check date conversion and date arithmetic
INSERT INTO TIMESTAMP_TBL VALUES ('1997-06-10 18:32:01 PDT');
diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql
index e60bacb962..71414f198e 100644
--- a/src/test/regress/sql/timestamptz.sql
+++ b/src/test/regress/sql/timestamptz.sql
@@ -74,9 +74,11 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-02-10 17:32:01 PST');
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb-10-1997 17:32:01 PST');
INSERT INTO TIMESTAMPTZ_TBL VALUES ('02-10-1997 17:32:01 PST');
INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970210 173201 PST');
+set datestyle to ymd;
INSERT INTO TIMESTAMPTZ_TBL VALUES ('97FEB10 5:32:01PM UTC');
INSERT INTO TIMESTAMPTZ_TBL VALUES ('97/02/10 17:32:01 UTC');
-INSERT INTO TIMESTAMPTZ_TBL VALUES ('97.041 17:32:01 UTC');
+reset datestyle;
+INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997.041 17:32:01 UTC');
-- Check date conversion and date arithmetic
INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT');