Problem with CAST-ing - am I missing something?

From: Pól Ua Laoínecháin <linehanp(at)tcd(dot)ie>
To: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Problem with CAST-ing - am I missing something?
Date: 2023-10-26 00:21:18
Message-ID: CAF4RT5QB7EY2SzeXBUdF9nB_ZPdMD0bab7zRZo4LqLVk=XWQEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

One of the things I really like about PostgreSQL is that it normally
does what I expect it to do - very little cognitive dissonance. But
I'm puzzled by something I came across this evening - took me ages to
figure it out!

I have a table (sample) as follows (code on fiddle:):

CREATE TABLE test (ts, te)
AS VALUES ('2023-10-25 14:33:00'::TIMESTAMPTZ, '2023-10-25
15:56:00'::TIMESTAMPTZ);

Now, this doesn't work:

SELECT (ts, te)::TSTZRANGE FROM test;

but this does:

SELECT TSTZRANGE(ts, te) FROM test;

Bug? Niggle? Can anyone explain to me why this is? To me, it's obvious
what I want to do with the first statement - ideas, pointers, URLs,
whatever welcome.

TIA and rgs,

Pól...

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2023-10-26 00:22:40 Re: purpose of an entry in pg_hba.conf file
Previous Message Atul Kumar 2023-10-26 00:10:48 purpose of an entry in pg_hba.conf file