public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: jian he <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: interval_scale not work as expected?
Date: Sun, 15 Oct 2023 20:28:43 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CACJufxHWW_ogDVRcCJPTjAg_AQXJPHrGDZjteGdxNhVo-etuHQ@mail.gmail.com>
References: <CACJufxHWW_ogDVRcCJPTjAg_AQXJPHrGDZjteGdxNhVo-etuHQ@mail.gmail.com>

jian he <[email protected]> writes:
> I thought:
> SELECT pg_catalog.interval('1 day 01:23:45.6789'::interval, 0)
> is same as
> SELECT interval(0) '1 day 01:23:45.6789'

[ shrug ]  No, it isn't.  Interval typmods have to carry a lot
more than just the fractional precision, because of all the
weird syntactic baggage that the SQL spec has for interval
types (i.e., YEAR TO MONTH and other options).  timestamp.h
has (some of) the details about what gets packed into an
interval typmod.

Even with simpler types, there generally isn't a one-to-one
correlation between user-visible precision and the encoded
typmod.

			regards, tom lane






view thread (2+ messages)

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: interval_scale not work as expected?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox