pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Fontana Daniel C. (Desartec S.R.L.) <desartecsrl@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Schema in trigger in logical replication
Date: Thu, 04 Mar 2021 13:07:31 -0500
Message-ID: <1374775.1614881251@sss.pgh.pa.us> (raw)
In-Reply-To: <c5211c6d-f2ee-10e6-bc9d-2b57875df0b9@aklaver.com>
References: <003501d7107d$75a67a80$60f36f80$@gmail.com>
	<217507fd-1fde-20f7-3950-7341602277a2@aklaver.com>
	<003601d71089$2b2a10a0$817e31e0$@gmail.com>
	<c5211c6d-f2ee-10e6-bc9d-2b57875df0b9@aklaver.com>

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 3/3/21 3:58 PM, Fontana Daniel C. (Desartec S.R.L.) wrote:
>> When the update is manual, it works.
>> It does not work when the update is done using logical replication.
>> It is as if the logical replication wizard did not use the search_path

> Replication would imply at least two database instances in use. If they 
> both don't have the same search_path set then there would be a problem. 

I'm fairly sure that replication workers run with search_path set
to just "pg_catalog" for security reasons.  Any user-written code
that needs to execute in a replication worker *must* schema-qualify
all references to non-system objects.

As a general rule, code that runs in expression indexes, check
constraints, and the like needs to be written to not make assumptions
about what search path it's invoked with.  Just fix it; your life
will be less painful.

			regards, tom lane





view thread (4+ messages)

Message-ID: <1374775.1614881251@sss.pgh.pa.us>
Permalink:  ../1374775.1614881251@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1374775.1614881251@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, desartecsrl@gmail.com
  Subject: Re: Schema in trigger in logical replication
  In-Reply-To: <1374775.1614881251@sss.pgh.pa.us>
  References: <003501d7107d$75a67a80$60f36f80$@gmail.com> <217507fd-1fde-20f7-3950-7341602277a2@aklaver.com> <003601d71089$2b2a10a0$817e31e0$@gmail.com> <c5211c6d-f2ee-10e6-bc9d-2b57875df0b9@aklaver.com> <1374775.1614881251@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox