Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLiVy-00GC3p-80 for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jun 2024 12:09:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sLiUx-008w7i-HP for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jun 2024 12:08:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLiUw-008w7Y-Vi for pgsql-hackers@lists.postgresql.org; Mon, 24 Jun 2024 12:08:39 +0000 Received: from pb-smtp20.pobox.com ([173.228.157.52]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLiUt-003Iam-3A for pgsql-hackers@lists.postgresql.org; Mon, 24 Jun 2024 12:08:37 +0000 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 2166E1F956; Mon, 24 Jun 2024 08:08:31 -0400 (EDT) (envelope-from david@justatheory.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=sasl; bh= FAkvsWarEMrOamDPQjmWTnvBnjJq2/gDhU/rlqSkJ4g=; b=WAfCpZtcbaYkFPkM 8NOBcWUShrZ2Nopj7PbIcAXkq8q/oeSICkAzAz/MSPX6ZCNAw0YZIJkl2WNl/I8k XwQnTAjm88Ix67YFx9MLnnVHU4nCnp4/+K7dyABEPsX/tT9fp45vFlyx3PfyrMA8 fLfj9EZwfU/YAPUuRIYd8K1Et2Q= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 1A4A91F955; Mon, 24 Jun 2024 08:08:31 -0400 (EDT) (envelope-from david@justatheory.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=justatheory.com; h=content-type:mime-version:subject:from:in-reply-to:date:cc:content-transfer-encoding:message-id:references:to; s=2016-12.pbsmtp; bh=FAkvsWarEMrOamDPQjmWTnvBnjJq2/gDhU/rlqSkJ4g=; b=TryFhHyJYNoHuBT18oZMhUq/2mnzqgI1v9sFsPqsw62ikz+2dHIJ6XoQGeTTx977WuNGLP4bEgsRuiqmKPBBcsy9YlDZFH/uoHWUTAORJI27UFWGT+8D4O12aM6HVCOfo1ktH7g+r/oypFQ3tXnTyNVtZXPiZOJrHYTqHm4z6VM= Received: from smtpclient.apple (unknown [158.222.197.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 636601F954; Mon, 24 Jun 2024 08:08:27 -0400 (EDT) (envelope-from david@justatheory.com) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Subject: Re: Inconsistent Parsing of Offsets with Seconds From: "David E. Wheeler" In-Reply-To: <4E09AE2B-918D-40BA-B1DE-534BCC9A873F@justatheory.com> Date: Mon, 24 Jun 2024 08:08:14 -0400 Cc: PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <5AF1E7E9-5856-4BE2-B691-3E41A0A903F5@justatheory.com> References: <788148.1719076559@sss.pgh.pa.us> <4E09AE2B-918D-40BA-B1DE-534BCC9A873F@justatheory.com> To: Tom Lane X-Mailer: Apple Mail (2.3774.500.171.1.1) X-Pobox-Relay-ID: 76DE1AF0-3222-11EF-8AAA-C38742FD603B-76319746!pb-smtp20.pobox.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Jun 22, 2024, at 14:10, David E. Wheeler = wrote: > I believe the former issue is caused by the latter: The jsonpath = implementation uses the formatting strings to parse the timestamps[1], = and since there is no formatting to support offsets with seconds, it = doesn=E2=80=99t work at all in JSON timestamp parsing. >=20 > [1]: = https://github.com/postgres/postgres/blob/70a845c/src/backend/utils/adt/js= onpath_exec.c#L2420-L2442 A side-effect of this implementation of date/time parsing using the = to_char templates is that only time zone offsets and abbreviations are = supported. I find the behavior a little surprising TBH: david=3D# select to_timestamp('2024-06-03 12:35:00America/New_York', = 'YYYY-MM-DD HH24:MI:SSTZ'); ERROR: invalid value "America/New_York" for "TZ" DETAIL: Time zone abbreviation is not recognized. Unless the SQL standard only supports offsets and abbreviations, I = wonder if we=E2=80=99d be better off updating the above parsing code to = also try the various date/time input functions, as well as the custom = formats that *are* defined by the standard. Best,