Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i1Sqk-0007bX-Ui for pgsql-general@arkaria.postgresql.org; Sat, 24 Aug 2019 10:00:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i1Sqj-0001hd-2o for pgsql-general@arkaria.postgresql.org; Sat, 24 Aug 2019 10:00:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i1Sqi-0001hW-It for pgsql-general@lists.postgresql.org; Sat, 24 Aug 2019 10:00:44 +0000 Received: from mout.gmx.net ([212.227.15.18]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i1Sqf-0001H7-DZ for pgsql-general@lists.postgresql.org; Sat, 24 Aug 2019 10:00:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1566640835; bh=phuSiRiMxgDgsWT3vJ3kuddGHH7LXnFmAnD2OWDdSjs=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=DIqOV1kDkDeStmysE+LWjbEyQx7H+TsFn2Pt4WRa/olb6CEWBpBw+52uVtx1e6PXb fsCCQqFMQ8bypYbQUIhd5lWpwwCKlqFX7eo2GIxU9AILeAQaNHzc91cDmvrOSeQN2q m4InzrNUbRd0z6VbPEEfON5o6lixxEKnUySeb5Wk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([77.13.30.150]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MV67o-1hcoxp0HPK-00S7Q9 for ; Sat, 24 Aug 2019 12:00:35 +0200 Received: from ncq by hermes with local (Exim 4.92) (envelope-from ) id 1i1SqY-0000xb-7b for pgsql-general@lists.postgresql.org; Sat, 24 Aug 2019 12:00:34 +0200 Date: Sat, 24 Aug 2019 12:00:34 +0200 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: timestamp out of range while casting return value to function's return type Message-ID: <20190824100034.GA7766@hermes.hilbert.loc> References: <20190824005707.Horde.lG5m5T6XNruzVvf0LZ6QFRV@webmail.gelassene-pferde.biz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190824005707.Horde.lG5m5T6XNruzVvf0LZ6QFRV@webmail.gelassene-pferde.biz> Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) User-Agent: Mutt/1.10.1 (2018-07-13) Sender: X-Provags-ID: V03:K1:BzTAlamF5LZsdH0sH3n7SqrJDAhMk/JjEWC6zpI/EAQtN5WntDO 9zP45mMT3NdnzRMGlVNvI8OCZyfPCE8lOtoIXB+PvcQIviV1qLYRwDnspMjTznlcMlsHCcI eYhysIO7z1jX3Axy+mnR43x1mw9mcuggvA00VobGXXwe3TBp5+pbvlM1jC55vZm/4nYFHGW 81vjOjFghT1RKiI2vrApQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:T+EFcyRzv2M=:HfRfgQSpUUKgpbGf9rSUu9 54XiPJvzv0Id4LTzpbavudpPQqE+Vh4iatwaxoqJF8/nwhTqukP5hEbj0nuZDaWz5j6sAEBQo uP+JN1rD/EFWutt6sriqc2RQTS62Bn4kpws8fiPS2coeohgjQ8gp3DymjRjCwM1gOEmwvywlQ ykToxaSCG/7mXKQSr7rmUKC+b3IoG08ZvHjN8gjtBsCj0MfU9mIpG2QMP6B8l9SQ4dmZDdfXN lM0LrvKpfMxjVi2bkxl7q3F0+/xc1kCnfoLMZGAN8/ELd6M2P+klu/R1mt+isBgmJyc+UkY+N +Jo03vougYzcYlkxSHaALmsAs3mB4TJH+ZKvRWg3lTNmoLawjZCgww67dkFizRMtNWuBl2bgD JiVooMs7e6Wr9rlgwmgX6oe/2uoMJxtC7GGnq/rrDDeZiE9zilVK9ix2BC7+904gMcDnLiYD4 DDbft5OBBFUoKjmWNuU/508sE+Or82yVdl8kwUDFOxrEWt2qBGBE1UuSpzUHwFZhRn8ZMIy9l 0jNfT31Si3SdzWUJDKggJvUlfzhf4jMQ3jE0+4/GmArkze3MKxPp3O3Z0h4IDK6hcVRn454h/ OSWt8cxnqt6h+5BMXinQSBpdz6SD5CNaZZcc4VfnybbOaki2IVe7DKZXNhL2S2sVSgRtCh5f4 1pmcV3t+/I6l+jjxHU4NhPv0j76Xoy+e2VuEtds+FyVNSmXQgTP6UH+CWmN2C4N9hYolCaRre voX2vfBH3sraAaQUO1Rt/0RvPOBLIW/4BPSBIeDZh5qgznSWRnPWPTbPl2B4ri9IVTspRBAEa kZnkiAXoLDkLJOvc/YBP5fPXQlaiTt8vjZw3EOGvr3jP1Ot9hSxXpb+rs0iQXt3KrSjtx/6eN TUzxCE8QqvN6Wqa+CiwiTKXPfwGvcmw2Boj3k0SNXEGQSQleug65s7xyeTvUzG+eEuKx+Cvij 4xds3QlTHCzg7azqjrpfgXBPDvnFGhbMgPDfOu3WvxFYHx+vNE/MuUN2vbHGLTH8HavEPJaR/ fUp/fmkGheH1VhVp3O7yuWFzf4TReUzYiwt8VmNbBchhm0TdNjg9XqKcT7x1Q0bPnjlZNgnrZ cffNBs2/Avcu92jCaYbj/uQrtyLyU5LC1JX8Ze0xz2iKZg9/hZX0rXYTLkDpZkx4l/G/Psyh0 pdDeluGj8lJHS4hXc1LuKnm8YM8lx/rvdDmvOJcldf/2WedA== Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 psql (11.5 (Debian 11.5-1+deb10u1)) gnumed_v22=3D> select 'infinity'::timestamptz; -[ RECORD 1 ]--------- timestamptz | infinity gnumed_v22=3D> 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 =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B