From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Interval input: usec, msec |
Date: | 2007-05-28 04:44:31 |
Message-ID: | 1180327472.6152.16.camel@goldbach |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
neilc=# select '1 day 1 millisecond'::interval;
interval
--------------------
1 day 00:00:00.001
(1 row)
neilc=# select '1 millisecond'::interval;
ERROR: invalid input syntax for type interval: "1 millisecond"
neilc=# select '0.001 seconds'::interval;
interval
--------------
00:00:00.001
(1 row)
Similarly for "microsecond".
I think allowing the first input but not the second is pretty
inconsistent. Attached is a patch that fixes this for both milliseconds
and microseconds. The previous coding allowed "x seconds y milliseconds"
to be specified, so this patch preserves that behavior. It *also* allows
"x seconds y seconds" as valid input, although you could make a
consistency argument for that anyway: (with CVS HEAD, unpatched)
neilc=# select '5 days 10 days'::interval;
interval
----------
15 days
neilc=# select '1 week 2 week 3 weeks'::interval;
interval
----------
42 days
neilc=# select '1 second 2 second'::interval;
ERROR: invalid input syntax for type interval: "1 second 2 second"
Is there any reason to why DecodeInterval() is willing to accept
multiple specifications for some time units but not others?
-Neil
Attachment | Content-Type | Size |
---|---|---|
timestamp_msec_input-1.patch | text/x-patch | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-05-28 14:50:06 | Re: Interval input: usec, msec |
Previous Message | Jim C. Nasby | 2007-05-27 19:01:36 | Re: Maintaining cluster order on insert |