Re: Interval input: usec, msec - Mailing list pgsql-patches

From Tom Lane
Subject Re: Interval input: usec, msec
Date
Msg-id 27724.1180363806@sss.pgh.pa.us
Whole thread Raw
In response to Interval input: usec, msec  (Neil Conway <neilc@samurai.com>)
Responses Re: Interval input: usec, msec  (Neil Conway <neilc@samurai.com>)
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> Is there any reason to why DecodeInterval() is willing to accept
> multiple specifications for some time units but not others?

I'd argue that it's an oversight.  I don't have a problem with adding up
the values of units that really translate to the same thing (eg,
'1 week 1 day' -> '8 days'), but I think '1 second 2 second' should
be rejected because it's almost certainly user error.

Does your patch allow '1 millisec 2 microsec', which should be allowed
by this argument?  I suspect that to make it work unsurprisingly, we'd
need to allocate a distinct tmask bit to each logically distinct unit.
(Maybe shortage of tmask bits is why the code is like it is?)

            regards, tom lane

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Interval input: usec, msec
Next
From: Neil Conway
Date:
Subject: Re: Interval input: usec, msec