pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: timestamp out of range while casting return value to function's return type
Date: Sat, 24 Aug 2019 12:00:34 +0200
Message-ID: <20190824100034.GA7766@hermes.hilbert.loc> (raw)
In-Reply-To: <20190824005707.Horde.lG5m5T6XNruzVvf0LZ6QFRV@webmail.gelassene-pferde.biz>
References: <20190824005707.Horde.lG5m5T6XNruzVvf0LZ6QFRV@webmail.gelassene-pferde.biz>

On Sat, Aug 24, 2019 at 12:57:07AM +0000, Thiemo Kellner wrote:

> Call: select utils.get_max_timestamptz();
> --
>
> Function
> --
> create or replace function GET_MAX_TIMESTAMPTZ()
>   returns timestamptz
>   language plpgsql
>   immutable
>   -- Include the hosting schema into search_path so that dblink
>   -- can find the pglogger objects. There is no need to access
>   -- objects in other schematas not covered with public.
>   as
> $body$
>     begin
>         -- highest timestamps on 64bit lubuntu vanilla PostgreSQL 11.3
>         return '294277-01-01 00:59:59.999999'::timestamptz;
>     end;
> $body$;

Also, but that's a nitpick perhaps not relevant to your use case:

This

	$> psql -d gnumed_v22 -U <redacted>
	psql (11.5 (Debian 11.5-1+deb10u1))

	gnumed_v22=> select 'infinity'::timestamptz;
	-[ RECORD 1 ]---------
	timestamptz | infinity

	gnumed_v22=>

is the highest timestamp.

(You *can* count the horses in *your* corral but there's
 always more of them elsewhere ;-)

Just so you are aware.

Best,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B





view thread (5+ messages)  latest in thread

Message-ID: <20190824100034.GA7766@hermes.hilbert.loc>
Permalink:  ../20190824100034.GA7766@hermes.hilbert.loc/
Also on:    postgresql.org/message-id/20190824100034.GA7766@hermes.hilbert.loc

 · 

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: Karsten.Hilbert@gmx.net
  Subject: Re: timestamp out of range while casting return value to function's return type
  In-Reply-To: <20190824100034.GA7766@hermes.hilbert.loc>
  References: <20190824005707.Horde.lG5m5T6XNruzVvf0LZ6QFRV@webmail.gelassene-pferde.biz> <20190824100034.GA7766@hermes.hilbert.loc>

* 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