From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sebastien Flaesch <sebastien.flaesch@4js.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: SUM() of INTERVAL type produces INTERVAL with no precision
Date: Fri, 03 Dec 2021 10:15:36 -0500
Message-ID: <2292656.1638544536@sss.pgh.pa.us> (raw)
In-Reply-To: <DBAP191MB1289209E98AA6F340651F7A3B06A9@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
References: <DBAP191MB1289209E98AA6F340651F7A3B06A9@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
Sebastien Flaesch <sebastien.flaesch@4js.com> writes:
> When doing a SUM( ) aggregate on an INTERVAL HOUR TO SECOND(0) column, the resulting type loses the interval type qualifiers...
We don't generally attribute a typmod (which is what interval field
specs are) to the output of any function, other than the ones that are
specifically identified in the catalogs as cast-to-a-particular-typmod
infrastructure. Why do you care? The value is the same regardless.
> The type of a SELECT item is important to us because we have generic C code that identifies the PQfmod() type, to properly interpret the string value returned by PQgetvalue().
I think you have vastly overestimated the value of PQfmod. Moreover,
if you think you need it to interpret the output data, you are mistaken.
There is no situation in which Postgres output formats are
typmod-specific; in fact, the output function API doesn't even pass
the typmod.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, sebastien.flaesch@4js.com
Subject: Re: SUM() of INTERVAL type produces INTERVAL with no precision
In-Reply-To: <2292656.1638544536@sss.pgh.pa.us>
References: <DBAP191MB1289209E98AA6F340651F7A3B06A9@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM> <2292656.1638544536@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox