Re: search_path for replica-mode

From: André Kutepow <a(dot)kutepow(at)prodat-sql(dot)de>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: search_path for replica-mode
Date: 2023-07-11 08:50:43
Message-ID: 625f6c11-5252-3b3b-575a-5625ddfa8ecc@prodat-sql.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks David G. Johnston

Am 10.07.2023 um 15:11 schrieb David G. Johnston:
> On Monday, July 10, 2023, André Kutepow <a(dot)kutepow(at)prodat-sql(dot)de> wrote:
>
> There is a trigger in the database
>
> SET search_path TO "$user", public;
>
> CREATE OR REPLACE FUNCTION art__a_iu_func()
> BEGIN
>   INSERT INTO table_z...   --//»table_z« is in schema public//
> END;
>
> CREATE OR REPLACE TRIGGER art__a_iu
>     AFTER INSERT OR UPDATE OF ak_nr
>     ON art
>     FOR EACH ROW
>     EXECUTE FUNCTION art__a_iu_func();
>
> In a regular trigger, it works great!
> But, if I announce it, as:
>
> ALTER TABLE art ENABLE REPLICA TRIGGER art__a_iu;
> then I get an error:
>
> /FEHLER:  Relation »table_z« existiert nicht bei Zeichen xxx//
> //ANFRAGE:  INSERT INTO table_z...
>
> /why does'nt work the search_path for replica-mode?
> is it made specifically or is it a bug?
> How else can I set the search_path for replica-mode?
>
>
> Relying on external search_path for system executed objects is
> problematic.  Don’t do it. Either attach a SET to the function or
> schema-qualify references.
>
> David J.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2023-07-11 11:01:20 RE: Support logical replication of DDLs
Previous Message KK CHN 2023-07-11 08:50:24 BI Reports and Postgres