pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: Francisco Olarte <folarte@peoplecall.com>
Cc: Michael Bondarenko <work.michael.2956@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Cc: dgrowleyml@gmail.com
Subject: Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
Date: Sat, 17 Feb 2024 21:19:08 -0500
Message-ID: <3749306.1708222748@sss.pgh.pa.us> (raw)
In-Reply-To: <CACJufxGB4MD6vRz3jVGK6kza-6fuDgfW2jC_1S2+MwcQYGkgSA@mail.gmail.com>
References: <18348-b097a3587dfde8a4@postgresql.org>
	<CAApHDvr_-05ce6FaLM0P=hJBdV=Ht3=sdk_Eq__7YOf+fs5x9g@mail.gmail.com>
	<CACJufxHYQSKNnt8rS7GxvK04wf75nw_ugMaibFVVfrcdVMmF1Q@mail.gmail.com>
	<CAF_O+z1FU5GN=LnW50QjANGVB8+6VxyK1JHa8fE-Xs205MFuqw@mail.gmail.com>
	<CA+bJJbw6q=6no1Hf67FraYGMo12asWCa7yw=J0zg_ELbivX0gw@mail.gmail.com>
	<3709307.1708201825@sss.pgh.pa.us>
	<CACJufxGB4MD6vRz3jVGK6kza-6fuDgfW2jC_1S2+MwcQYGkgSA@mail.gmail.com>

jian he <jian.universality@gmail.com> writes:
> you already mentioned "Not all fields are valid for every input data type".
> interval data type don't even have a unit "quarter",
> so the following should generate an error?
> select extract(quarter from interval '2011 year 12 month 48 hour
> 1005min 2 sec 11 ms');

I'm not especially persuaded by that reasoning.  Intervals don't have
century or millisecond fields either, but we allow extracting those.

If your argument is that we shouldn't allow it because we don't take
the input INTERVAL '1 quarter', I'd be much more inclined to add that
as valid input than to take away existing extract functionality.
But I'm dubious about the proposition that extract's list of valid
fields should exactly match the set of allowed input units.  The
semantics aren't really the same (as per the '80 minutes' example)
so such a restriction doesn't seem to have much basis in reality.

			regards, tom lane





view thread (31+ messages)  latest in thread

Message-ID: <3749306.1708222748@sss.pgh.pa.us>
Permalink:  ../3749306.1708222748@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3749306.1708222748@sss.pgh.pa.us

 · 

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: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jian.universality@gmail.com, folarte@peoplecall.com, work.michael.2956@gmail.com, pgsql-bugs@lists.postgresql.org, dgrowleyml@gmail.com
  Subject: Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
  In-Reply-To: <3749306.1708222748@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