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 1s91d2-00Gqfq-7O for pgsql-general@arkaria.postgresql.org; Mon, 20 May 2024 11:56:33 +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 1s91d2-001GJn-38 for pgsql-general@arkaria.postgresql.org; Mon, 20 May 2024 11:56:32 +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 1s91d1-001GJf-MG for pgsql-general@lists.postgresql.org; Mon, 20 May 2024 11:56:31 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s91cy-0017I0-Kj for pgsql-general@lists.postgresql.org; Mon, 20 May 2024 11:56:30 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4Vjbd32WN3z9sxN; Mon, 20 May 2024 13:56:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1716206183; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BuJ3gL+HYb6XvSH4Ir2/1dDp/BLIBYa2wqBxKF8+wiE=; b=gboEpAZ7dYynRimF6sorZBrNbz97VVRphPFrLCu9YT4EpdXq4NXfmWFAONvTeBQ2Q+ey8n gBvsBUs7oL/JF45AiXLpWw4y0ifRXqr2BYTlkTSnjx3APaYVX4qjjN4GixsPDA1eqQeV/y DKS38PYdISqpSWyPCFNPL2rZ5mVHADs1ahPFdXkxtbPWevKKnzwV9OFB1mOF2MorwMrdwJ 7xNaahvBaZMMBidfJkO/6GWK8fPSyODWeH8frTEEpDA7NXoOb4bWg7Gh6falOvtrWrPEzi 6qeZPwXoVVIvTm5POBykRmkTJw6GZxzPK0P4/U6ggjJBlX1ACtTVVZkadNX2PA== Date: Mon, 20 May 2024 13:56:21 +0200 From: Erik Wienhold To: Laura Smith Cc: postgre Subject: Re: How to update upper-bound of tstzrange ? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4Vjbd32WN3z9sxN List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-05-20 12:30 +0200, Laura Smith wrote: > Could someone kindly help me out with the correct syntax ? > > My first thought was the below but that doesn't work: > > update foo set upper(bar_times)=upper(bar_times)+interval '1' hour where bar_id='abc'; > ERROR: syntax error at or near "(" > LINE 1: update event_sessions set upper(bar_times)=upper(bar_ti... Use the constructor function: UPDATE foo SET bar_times = tstzrange(lower(bar_times), upper(bar_times) + interval '1' hour); But this does not preserve the inclusivity/exclusivity of bounds from the input range, so you may have to pass in the third argument as well. https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-CONSTRUCT -- Erik