Alvaro Herrera <alvherre(at)2ndquadrant(dot)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