Re: interval typmodout is broken - Mailing list pgsql-hackers

From Tom Lane
Subject Re: interval typmodout is broken
Date
Msg-id 30048.1411591455@sss.pgh.pa.us
Whole thread Raw
In response to interval typmodout is broken  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: interval typmodout is broken
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> I just noticed when working on DDL deparsing that the typmodout routine
> for intervals is broken.  The code uses

>     if (precision != INTERVAL_FULL_PRECISION)
>         snprintf(res, 64, "%s(%d)", fieldstr, precision);
>     else
>         snprintf(res, 64, "%s", fieldstr);

> which puts the parenthised number after the textual name; but the
> grammar only takes it the other way around.

You sure about that?  The grammar for INTERVAL is weird.  I believe
the output we're trying to produce here is something like
INTERVAL HOUR TO SECOND(2)

where "fieldstr" would be " HOUR TO SECOND" and "precision" would
give the fractional-second precision.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: missing isinf declaration on solaris
Next
From: Stephen Frost
Date:
Subject: Re: Review of GetUserId() Usage