1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

here is a patch for formatting.c (to_char/timestampt()), for 7.1

it fixing Y,YY,YYY,YYYY conversion, the docs and regress tests update
 are included too.

  During the patch testing I found small bug in miscadmin.h in
convertstr() declaration. Here it's fixed too.

 Thanks

        Karel
This commit is contained in:
Bruce Momjian
2000-11-25 05:00:33 +00:00
parent 91ba4cc761
commit 3f1998727d
5 changed files with 242 additions and 100 deletions

View File

@ -1560,9 +1560,9 @@ SELECT '' AS to_timestamp_5, to_timestamp('1,582nd VIII 21', 'Y,YYYth FMRM DD');
SELECT '' AS to_timestamp_6, to_timestamp('15 "text bettween quote marks" 98 54 45',
'HH "\\text bettween quote marks\\"" YY MI SS');
to_timestamp_6 | to_timestamp
----------------+--------------------------
| Wed Jan 01 15:54:45 0098
to_timestamp_6 | to_timestamp
----------------+------------------------------
| Thu Jan 01 15:54:45 1998 PST
(1 row)
@ -1578,4 +1578,36 @@ SELECT '' AS to_timestamp_8, to_timestamp('2000January09Sunday', 'YYYYFMMonthDDF
| Sun Jan 09 00:00:00 2000 PST
(1 row)
SELECT '' AS to_timestamp_9, to_timestamp('97/Feb/16', 'YYMonDD');
ERROR: to_timestamp(): bad value for MON/Mon/mon
SELECT '' AS to_timestamp_10, to_timestamp('19971116', 'YYYYMMDD');
to_timestamp_10 | to_timestamp
-----------------+------------------------------
| Sun Nov 16 00:00:00 1997 PST
(1 row)
SELECT '' AS to_timestamp_11, to_timestamp('20000-1116', 'YYYY-MMDD');
to_timestamp_11 | to_timestamp
-----------------+---------------------------
| Thu Nov 16 00:00:00 20000
(1 row)
SELECT '' AS to_timestamp_12, to_timestamp('9-1116', 'Y-MMDD');
to_timestamp_12 | to_timestamp
-----------------+------------------------------
| Mon Nov 16 00:00:00 2009 PST
(1 row)
SELECT '' AS to_timestamp_13, to_timestamp('95-1116', 'YY-MMDD');
to_timestamp_13 | to_timestamp
-----------------+------------------------------
| Thu Nov 16 00:00:00 1995 PST
(1 row)
SELECT '' AS to_timestamp_14, to_timestamp('995-1116', 'YYY-MMDD');
to_timestamp_14 | to_timestamp
-----------------+------------------------------
| Thu Nov 16 00:00:00 1995 PST
(1 row)
SET DateStyle TO DEFAULT;

View File

@ -223,4 +223,16 @@ SELECT '' AS to_timestamp_7, to_timestamp('05121445482000', 'MMDDHHMISSYYYY');
SELECT '' AS to_timestamp_8, to_timestamp('2000January09Sunday', 'YYYYFMMonthDDFMDay');
SELECT '' AS to_timestamp_9, to_timestamp('97/Feb/16', 'YYMonDD');
SELECT '' AS to_timestamp_10, to_timestamp('19971116', 'YYYYMMDD');
SELECT '' AS to_timestamp_11, to_timestamp('20000-1116', 'YYYY-MMDD');
SELECT '' AS to_timestamp_12, to_timestamp('9-1116', 'Y-MMDD');
SELECT '' AS to_timestamp_13, to_timestamp('95-1116', 'YY-MMDD');
SELECT '' AS to_timestamp_14, to_timestamp('995-1116', 'YYY-MMDD');
SET DateStyle TO DEFAULT;