Re: interval typmodout is broken

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: interval typmodout is broken
Date: 2014-09-24 20:44:15
Message-ID: 30048.1411591455@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-09-24 20:58:24 Re: Review of GetUserId() Usage
Previous Message Alvaro Herrera 2014-09-24 20:39:19 Re: missing isinf declaration on solaris