interval typmodout is broken

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: interval typmodout is broken
Date: 2014-09-24 20:31:14
Message-ID: 20140924203114.GS5311@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

This has been wrong since commit 5725b9d9afc8 dated Dec 30 2006, which
introduced the whole notion of type-specific typmod output functions.
I don't understand how come nobody has noticed this in eight years.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-09-24 20:35:55 Re: RLS feature has been committed
Previous Message Tom Lane 2014-09-24 20:26:33 Re: missing isinf declaration on solaris