Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYFMt-0001z5-9Z for pgsql-general@arkaria.postgresql.org; Wed, 06 Oct 2021 22:26:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mYFMr-0004DJ-Vw for pgsql-general@arkaria.postgresql.org; Wed, 06 Oct 2021 22:26:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYFMq-0004DA-NX for pgsql-general@lists.postgresql.org; Wed, 06 Oct 2021 22:26:29 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYFMl-0002wV-BX for pgsql-general@lists.postgresql.org; Wed, 06 Oct 2021 22:26:28 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 2ED173200645; Wed, 6 Oct 2021 18:26:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 06 Oct 2021 18:26:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=J EswYkS5ppdG2ud+8n3TIBg4xExSr/fIzpdMbTF6KUk=; b=pNe2DczlFyWyA4Pd+ MM1iAbruQ8eTTfvEMNAumgwpTVSp7hVYfI22Yu9czG8bY+xDVm5KigxBS4VB/dV1 2uUNt0tP6nYDlxkRxPWx4eB9d79obYHcILHfYjHb0fC+BC6p0JdV0KubdCXWpFzr UySi4R64vNk0vrHcx6Emqn9n3OZ4/QwAXu44CnJ0JUhZloApWUbDcXbGfLndnS3R gai5CEKs/Tac5VW74cEqLa9fLLqs39v1/QBFiqgO1bWPIHoOl+6qF0WXRYQneDQA wZRF7gTkFjVEhzNoh40yePE5fc6k4tHc10sorS2KpVevMShYtSknlPr+DbmvZg7J SfiQw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=JEswYkS5ppdG2ud+8n3TIBg4xExSr/fIzpdMbTF6K Uk=; b=VUG2BicC+OFojWni8UEOtacWNOh2rISKenHN9do3voLw5J5TfHv8b8Wrm /gTR09WX+I3Q/0K6/xspVe431STObB2fKRlR80kGoNpUPAXwVLw84NgNs6imRR7P +FaPY7aLWfLQTgzBREcL75kAcQG3+sf+Kgc0ro6Gsmf/luoBMIjTn811/vHLfCRU zCBkDzGzhdrEt9aRpRAe3Ls0YOsjxBPkMRnTPsCaN2peoOF8WH+sDiZCoFkhhrEK vTlcXvpGtwghfJxV6DyJ1BFI+cyW/rrrz51ZNh6t7NeA3kohv1oA0aH6vLnOkzEL +k6pDkysEYVLqymg10hFz+NEGngBw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeljedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeevteejtdeikeetfefhhffhteelvdekffevudegjeeu kefhgfdvieeliedtkeevhfenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Oct 2021 18:26:18 -0400 (EDT) Subject: Re: Using make_timestamp() to create a BC value To: Bryn Llewellyn , pgsql-general list References: <010C91D3-9982-445D-B3C1-B20BD1E8C841@yugabyte.com> From: Adrian Klaver Message-ID: <971fc235-135e-3d11-9ae2-df4ff14c6d2a@aklaver.com> Date: Wed, 6 Oct 2021 15:26:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <010C91D3-9982-445D-B3C1-B20BD1E8C841@yugabyte.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/6/21 2:59 PM, Bryn Llewellyn wrote: > Everything that I say here applies to "make_timestamptz()", too. But my > code examples need less typing when I use plain "make_timestamp()". > > (And sure enough, "raise info 'year: %', year" reports "-1".) > > The doc for "make_timestamp()" here: > > www.postgresql.org/docs/14/functions-datetime.html > > What version of Postgres are you using? Postgres 13: select extract(year from '0001-01-01 00:00:00 BC'::timestamp); date_part ----------- -1 select make_timestamp(-1,1,1,2,30,0); ERROR: date field value out of range: -1-01-01 Postgres 14: select extract(year from '0001-01-01 00:00:00 BC'::timestamp); date_part ----------- -1 select make_timestamp(-1,1,1,2,30,0); make_timestamp ------------------------ 0001-01-01 02:30:00 BC Postgres release notes https://www.postgresql.org/docs/current/release-14.html#id-1.11.6.5.3 Allow make_timestamp()/make_timestamptz() to accept negative years (Peter Eisentraut) Negative values are interpreted as BC years. -- Adrian Klaver adrian.klaver@aklaver.com