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 1rO2P2-000gDg-A5 for pgsql-general@arkaria.postgresql.org; Thu, 11 Jan 2024 21:15:52 +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 1rO2P1-00F1be-0j for pgsql-general@arkaria.postgresql.org; Thu, 11 Jan 2024 21:15:51 +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 1rO2P0-00F1bV-KB for pgsql-general@lists.postgresql.org; Thu, 11 Jan 2024 21:15:50 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rO2Oy-0014XH-24 for pgsql-general@lists.postgresql.org; Thu, 11 Jan 2024 21:15:49 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 45C963200BCC; Thu, 11 Jan 2024 16:15:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 11 Jan 2024 16:15:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1705007745; x=1705094145; bh=23AJauJJaz3zpscQSzO3HHeLArbeAVZ84FbQHFdL9FQ=; b= BDcau1ZGu1xMu2ChHBpzH3Rpd1IS8CeVtJDgWMq0zyf4ViCAaOGXQS9Ukb2pSGfo Z5PEC+8bk7VQi3LPuBQVij/gTLPpRQwGTzf486nXywNjFeajjDe0aorXdlciccdH LUiPjF5tr0KfCWuRcR+SuPNEBEwvP/oxWbB6q44Jo0sD/9fQpJz3ek72wjGpa0Ub iWDx7mYUkQqW570tVwmnlrV/K2nDuh4UCrHB0SMS7lwBAaE8+ZRoAdvQVAPS0nWh l0OH/8ahD6a8RZTiVvRCN+xQrA/fgNy55yCszMamagbsndjPJ/t7H7vE65FCC+yk MAprjF160dmyhXKzljMLOQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1705007745; x= 1705094145; bh=23AJauJJaz3zpscQSzO3HHeLArbeAVZ84FbQHFdL9FQ=; b=Z /T9zrXcHQIp9ZYEx5CUeuHm6PYrImJkyZzuq6oDl35k2mXYAFv3/5B3Jgcl9YJph BeSlUSyIbqjjzvAteYTzBBO+Pp0uRHRyYOG/jWO5v8gR0LmtQ9DgMk3wf/BNDLVd GGF5cOLK8NsOtGt13wwTwLkET5PoG/9B/XtESmDPd9Xe0pNqBVzwMVNRzI6q+Ry9 OeH2QcxlOuH+yGGZ/raIUlIeFH9z/I9Fa3iR2lnUP85pMNKL6lG21oZn94TTBgH6 pZHTIXPsv7jbzZbSZR8KgeoRQUGtM3GDy0e9YjTeJtM02rj+FrKVmaOaUYGmguh8 gEiRn+OjKyZVfB89KVCgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeifedgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvvehfhfgjtgfgse htkeertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghn rdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepfeegfe eiuedtgffgteeggfehkeejheetieeliefgteeikeejvdeiveeigfehvedtnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklh grvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 11 Jan 2024 16:15:44 -0500 (EST) Message-ID: Date: Thu, 11 Jan 2024 13:15:44 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Time zone offset in to_char() Content-Language: en-US To: Alban Hertroys Cc: Alban Hertroys , "pgsql-general@lists.postgresql.org" References: <11b56239-9f18-4b94-aeac-395648a2bfe3@aklaver.com> <752055E6-31DA-404F-AB5E-0BAB83836108@gmail.com> From: Adrian Klaver In-Reply-To: <752055E6-31DA-404F-AB5E-0BAB83836108@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/11/24 11:04, Alban Hertroys wrote: > > I did manage to apply it to the second function header, which I think behaves such that the time zone change stays within function scope. Right now I’m not 100% sure that I verified that. More to check tomorrow. CREATE OR REPLACE FUNCTION public.tz_fnc2() RETURNS void LANGUAGE plpgsql SET "TimeZone" TO 'UTC' AS $function$ BEGIN RAISE NOTICE '%', to_char(now(), 'OF'); END; $function$; test=# begin ; BEGIN test=*# select public.tz_fnc2(); NOTICE: +00 tz_fnc2 --------- (1 row) test=*# show timezone; TimeZone ---------- UTC (1 row) test=*# commit ; COMMIT test=# show timezone; TimeZone ---------- UTC (1 row) > > Frankly, I do hope that you’re right here, that would make my work easier. > > Alban Hertroys > -- > If you can't see the forest for the trees, > cut the trees and you'll find there is no forest. > -- Adrian Klaver adrian.klaver@aklaver.com