pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amitabh Kant <amitabhkant@gmail.com>
Cc: PGSQL Mailing List <pgsql-general@postgresql.org>
Cc: Marcos Pegoraro <marcos@f10.com.br>
Subject: Re: Finding free time period on non-continous tstzrange field values
Date: Thu, 01 Dec 2022 09:29:39 -0500
Message-ID: <1564925.1669904979@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPTAQB++ZfCivCb7FSsDmRrTYvSd2_wJarXjh5EBdp2HO0ACHA@mail.gmail.com>
References: <CAPTAQBJn_BRL4hLYcCpVmn_FQ2gCpiQXv5FFbkGwV2E5hrdVJA@mail.gmail.com>
	<CAPTAQB++ZfCivCb7FSsDmRrTYvSd2_wJarXjh5EBdp2HO0ACHA@mail.gmail.com>

Amitabh Kant <amitabhkant@gmail.com> writes:
> I tried the following query :

> SELECT tstzmultirange(tstzrange('2022-11-25 00:00:00', '2022-11-30
> 00:00:00', '[]')) -
>   range_agg(time_range) AS availability
> FROM test_time_range
> WHERE time_range && tstzrange('2022-11-25 00:00:00', '2022-11-30 00:00:00',
> '[]');

> but then I receive the following error. My guess is I need to cast the
> tstzrange output, but can't seem to find the correct cast.

> ERROR: function tstzmultirange(tstzrange) does not exist
> LINE 1: SELECT tstzmultirange(tstzrange('2022-11-25 00:00:00', '2022... ^
> HINT: No function matches the given name and argument types. You might need
> to add explicit type casts. SQL state: 42883 Character: 8

That function certainly should exist:

psql (14.6)
Type "help" for help.

postgres=# \df tstzmultirange
                              List of functions
   Schema   |      Name      | Result data type | Argument data types  | Type 
------------+----------------+------------------+----------------------+------
 pg_catalog | tstzmultirange | tstzmultirange   |                      | func
 pg_catalog | tstzmultirange | tstzmultirange   | VARIADIC tstzrange[] | func
 pg_catalog | tstzmultirange | tstzmultirange   | tstzrange            | func
(3 rows)

My guess is that your server is not in fact PG14, but some
older version.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <1564925.1669904979@sss.pgh.pa.us>
Permalink:  ../1564925.1669904979@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1564925.1669904979@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 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, amitabhkant@gmail.com, marcos@f10.com.br
  Subject: Re: Finding free time period on non-continous tstzrange field values
  In-Reply-To: <1564925.1669904979@sss.pgh.pa.us>
  References: <CAPTAQBJn_BRL4hLYcCpVmn_FQ2gCpiQXv5FFbkGwV2E5hrdVJA@mail.gmail.com> <CAPTAQB++ZfCivCb7FSsDmRrTYvSd2_wJarXjh5EBdp2HO0ACHA@mail.gmail.com> <1564925.1669904979@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