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 1rcu7U-002n1c-Og for pgsql-general@arkaria.postgresql.org; Wed, 21 Feb 2024 21:27:13 +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 1rcu7T-006dvn-DR for pgsql-general@arkaria.postgresql.org; Wed, 21 Feb 2024 21:27:11 +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 1rcu7T-006dvf-38 for pgsql-general@lists.postgresql.org; Wed, 21 Feb 2024 21:27:11 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rcu7P-000KMX-V2 for pgsql-general@lists.postgresql.org; Wed, 21 Feb 2024 21:27:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 41LLR7CD154271; Wed, 21 Feb 2024 16:27:07 -0500 From: Tom Lane To: Vick Khera cc: pgsql-general@lists.postgresql.org Subject: Re: How to schema-qualify "IS DISTINCT FROM" on trigger definition? (I created a db that cannot be dump/restored) In-reply-to: References: Comments: In-reply-to Vick Khera message dated "Wed, 21 Feb 2024 16:11:30 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <154269.1708550827.1@sss.pgh.pa.us> Date: Wed, 21 Feb 2024 16:27:07 -0500 Message-ID: <154270.1708550827@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Vick Khera writes: > I've created a database which my vendor (Supabase) cannot > dump/restore/upgrade. Ultimately, it comes down to this trigger statement, > and the fact that the underlying operations needed to perform the `IS > DISTINCT FROM` comparison in the WHEN clause need to be found in the > `public` schema. During the restore, the search path is empty, so it fails. Yeah. We've had some discussions about inventing a version of IS DISTINCT FROM (and some other SQL-spec syntaxes with the same problem) that supports schema-qualification of the underlying operator. But it hasn't gotten further than preliminary discussion. For the moment, I think the only feasible solution is for your trigger function to set the search path it needs by adding a "SET search_path = whatever" clause to the function's CREATE command. regards, tom lane