Re: How to schema-qualify "IS DISTINCT FROM" on trigger definition? (I created a db that cannot be dump/restored)

From: Vick Khera <vivek(at)khera(dot)org>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to schema-qualify "IS DISTINCT FROM" on trigger definition? (I created a db that cannot be dump/restored)
Date: 2024-02-23 14:32:47
Message-ID: CALd+dcf8ru8NP5epTuDXnFzvfdYH94bOHfoYOu08HrKGaroT=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 22, 2024 at 5:06 PM Erik Wienhold <ewie(at)ewie(dot)name> wrote:

> On 2024-02-22 22:14 +0100, Vick Khera wrote:
> > On Wed, Feb 21, 2024 at 4:27 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > > 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.
> >
> >
> > The error is not in the function, it is the WHEN clause of the trigger.
> > There's no way to set a search path on the trigger as far as I see.
> >
> > The only option I see is to remove the WHEN clause on the trigger and
> wrap
> > my function with an IF with those same conditions. I hope this will not
> > result in any noticeable difference in speed.
>
> You may also try the equivalent CASE expression in the WHEN clause.
>
>
> https://wiki.postgresql.org/wiki/Is_distinct_from#Writing_with_CASE_statements
>

Nice. It makes for a big ugly trigger statement, but probably my better
choice. I was considering doing this but didn't want to risk making my own
interpretation.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-02-23 15:09:25 Re: Fwd: Unexpected Multiple Records from Randomized Query
Previous Message Matthew Dennison 2024-02-23 12:11:52 Unable to get PostgreSQL 15 with Kerberos (GSS) working