diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-11 02:42:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-11 02:42:33 +0000 |
commit | a4917bef0ead2424bf0c2eeb05dfb681dff33574 (patch) | |
tree | fab289925753819e2cce4729f92e388735c3b77c /src/backend/utils/adt/nabstime.c | |
parent | a44564b4f8b5aedc6d48cb70b4985bb2cde0a258 (diff) | |
download | postgresql-a4917bef0ead2424bf0c2eeb05dfb681dff33574.tar.gz postgresql-a4917bef0ead2424bf0c2eeb05dfb681dff33574.zip |
Add support for input and output of interval values formatted per ISO 8601;
specifically, we can input either the "format with designators" or the
"alternative format", and we can output the former when IntervalStyle is set
to iso_8601.
Ron Mayer
Diffstat (limited to 'src/backend/utils/adt/nabstime.c')
-rw-r--r-- | src/backend/utils/adt/nabstime.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 6744818e412..0dd8ab5e5a6 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.157 2008/11/09 00:28:35 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.158 2008/11/11 02:42:32 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -634,6 +634,12 @@ reltimein(PG_FUNCTION_ARGS) if (dterr == 0) dterr = DecodeInterval(field, ftype, nf, INTERVAL_FULL_RANGE, &dtype, tm, &fsec); + + /* if those functions think it's a bad format, try ISO8601 style */ + if (dterr == DTERR_BAD_FORMAT) + dterr = DecodeISO8601Interval(str, + &dtype, tm, &fsec); + if (dterr != 0) { if (dterr == DTERR_FIELD_OVERFLOW) |