diff options
| author | Robert Haas | 2022-03-14 20:46:46 +0000 |
|---|---|---|
| committer | Robert Haas | 2022-03-14 20:50:54 +0000 |
| commit | 9dde82899cdf48bd7b2f3d83e4f724ac9ae02c79 (patch) | |
| tree | c9416e326e2a0b1c0f412f67a4eb40e40b09c99e /src/test | |
| parent | 705e20f8550c0e8e47c0b6b20b5f5ffd6ffd9e33 (diff) | |
Support "of", "tzh", and "tzm" format codes.
The upper case versions "OF", "TZH", and "TZM" are already supported,
and all other format codes that are supported in upper case are also
supported in lower case, so we should support these as well for
consistency.
Nitin Jadhav, with a tiny cosmetic change by me. Reviewed by Suraj
Kharage and David Zhang.
Discussion: http://postgr.es/m/CAMm1aWZ-oZyKd75+8D=VJ0sAoSwtdXWLP-MAWD4D8R1Dgandzw@mail.gmail.com
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/timestamptz.out | 65 | ||||
| -rw-r--r-- | src/test/regress/sql/timestamptz.sql | 22 |
2 files changed, 87 insertions, 0 deletions
diff --git a/src/test/regress/expected/timestamptz.out b/src/test/regress/expected/timestamptz.out index 990c4eddf13..d402802db0d 100644 --- a/src/test/regress/expected/timestamptz.out +++ b/src/test/regress/expected/timestamptz.out @@ -2167,6 +2167,71 @@ SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; (1 row) RESET timezone; +-- Check of, tzh, tzm with various zone offsets. +SET timezone = '00:00'; +SELECT to_char(now(), 'of') as "Of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + Of | tzh:tzm +-----+--------- + +00 | +00:00 +(1 row) + +SET timezone = '+02:00'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +-----+--------- + -02 | -02:00 +(1 row) + +SET timezone = '-13:00'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +-----+--------- + +13 | +13:00 +(1 row) + +SET timezone = '-00:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +--------+--------- + +00:30 | +00:30 +(1 row) + +SET timezone = '00:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +--------+--------- + -00:30 | -00:30 +(1 row) + +SET timezone = '-04:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +--------+--------- + +04:30 | +04:30 +(1 row) + +SET timezone = '04:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +--------+--------- + -04:30 | -04:30 +(1 row) + +SET timezone = '-04:15'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +--------+--------- + +04:15 | +04:15 +(1 row) + +SET timezone = '04:15'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; + of | tzh:tzm +--------+--------- + -04:15 | -04:15 +(1 row) + +RESET timezone; CREATE TABLE TIMESTAMPTZ_TST (a int , b timestamptz); -- Test year field value with len > 4 INSERT INTO TIMESTAMPTZ_TST VALUES(1, 'Sat Mar 12 23:58:48 1000 IST'); diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql index b18821de53b..7cd2420b080 100644 --- a/src/test/regress/sql/timestamptz.sql +++ b/src/test/regress/sql/timestamptz.sql @@ -360,6 +360,28 @@ SET timezone = '04:15'; SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; RESET timezone; +-- Check of, tzh, tzm with various zone offsets. +SET timezone = '00:00'; +SELECT to_char(now(), 'of') as "Of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '+02:00'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '-13:00'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '-00:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '00:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '-04:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '04:30'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '-04:15'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +SET timezone = '04:15'; +SELECT to_char(now(), 'of') as "of", to_char(now(), 'tzh:tzm') as "tzh:tzm"; +RESET timezone; + + CREATE TABLE TIMESTAMPTZ_TST (a int , b timestamptz); -- Test year field value with len > 4 |
