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 1soPeB-00B5Hq-Uc for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Sep 2024 15:52:49 +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 1soPeB-0039Lk-KX for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Sep 2024 15:52:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1soPeB-0039La-3C for pgsql-hackers@lists.postgresql.org; Wed, 11 Sep 2024 15:52:47 +0000 Received: from pb-smtp1.pobox.com ([64.147.108.70]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1soPe8-000exg-2F for pgsql-hackers@lists.postgresql.org; Wed, 11 Sep 2024 15:52:45 +0000 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 0C5A619FE4; Wed, 11 Sep 2024 11:52:43 -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= WsEW0vXj76v5NFzQsSEuIrD4ROcdXFUx+aint4uR/QU=; b=uoX93PnGX6fRcg7Z RMQqCVeen6OhIC9srCL8ZrR2SbCWnWv4WOHz1H6UumzVBN8Wa+WMqbgN5vbAHD3J NsvXAbUPE8l18NIXbmzW3UF7yKCOn9IxNLLb+PtIOw/M5yzOK73QCEYlXEr2wBWM cyLgiN2qISdHbpHp3JmIqinWjJk= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 020DB19FE3; Wed, 11 Sep 2024 11:52:43 -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=WsEW0vXj76v5NFzQsSEuIrD4ROcdXFUx+aint4uR/QU=; b=e0SPD7teSRqCPgNCqzACRwYc4zVH49c9MJGgCsKvJj1fNoBAqUjLICMBucn+v/3MhfS/gUgtXNVAsG3RJMmPad0W7uOoRPpgvRlPX1rB35DnmiJ9GBn1r3dd0y//o2/HviEovXQuk6fYFDD+4AtKoTvQy/S2VUarBvofNXC4HvE= 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-smtp1.pobox.com (Postfix) with ESMTPSA id 6C53F19FE2; Wed, 11 Sep 2024 11:52:42 -0400 (EDT) (envelope-from david@justatheory.com) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: Document DateStyle effect on jsonpath string() From: "David E. Wheeler" In-Reply-To: <3824427.1726067484@sss.pgh.pa.us> Date: Wed, 11 Sep 2024 11:52:31 -0400 Cc: Peter Eisentraut , jian he , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <5801E26B-E2AB-4BA3-8B69-EF8837389284@justatheory.com> References: <56955B33-6959-4FDA-A459-F00363ECDFEE@justatheory.com> <4D874C72-8939-4083-8336-AB114D9E29AD@justatheory.com> <3541398.1725994308@sss.pgh.pa.us> <3654686.1725999372@sss.pgh.pa.us> <5e8879d0-a3c8-4be2-950f-d83aa2af953a@eisentraut.org> <3811774.1726063865@sss.pgh.pa.us> <3824427.1726067484@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3776.700.51) X-Pobox-Relay-ID: E14074C6-7055-11EF-99C5-2BAEEB2EC81B-76319746!pb-smtp1.pobox.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sep 11, 2024, at 11:11, Tom Lane wrote: > What "let result be stringified" behavior are you thinking of, > exactly? AFAICS there's not sensitivity to timezone unless you > use the _tz variant, otherwise it just regurgitates the input. There is stringification of a time, date, or timestamp value, which has = no TZ, but is still affected by DateStyle. Then there is stringification = of timetz or timestamptz, which can be created by the .time_tz() and = .timstamp_tz() functions, and therefore are impacted by both the = DateStyle and TimeZone configs, even when not using the _tz variant: david=3D# set timezone =3D 'America/New_York'; SET david=3D# select jsonb_path_query('"2023-08-15 12:34:56-09"', = '$.timestamp_tz().string()'); jsonb_path_query =20 -------------------------- "2023-08-15 17:34:56-04" david=3D# set timezone =3D 'America/Los_Angeles'; SET david=3D# select jsonb_path_query('"2023-08-15 12:34:56-09"', = '$.timestamp_tz().string()'); jsonb_path_query =20 -------------------------- "2023-08-15 14:34:56-07" (1 row) > I agree that we should force ISO datestyle, but I'm not quite sure > about whether we're in the clear with timezone handling. We already > had a bunch of specialized rules about timezone handling in the _tz > and not-_tz variants of these functions. It seems to me that simply > forcing UTC would not be consistent with that pre-existing behavior. > However, I may not have absorbed enough caffeine yet. True, it would not be consistent with the existing behaviors, but I = believe these are all new in Postgres 17. Best, David