pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedsearch_path for replica-mode
4+ messages / 3 participants
[nested] [flat]
* search_path for replica-mode
@ 2023-07-10 08:27 André Kutepow <isaev.mail@mail.ru>
0 siblings, 0 replies; 4+ messages in thread
From: André Kutepow @ 2023-07-10 08:27 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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?
^ permalink raw reply [nested|flat] 4+ messages in thread
* search_path for replica-mode
@ 2023-07-10 10:21 André Kutepow <a.kutepow@prodat-sql.de>
0 siblings, 1 reply; 4+ messages in thread
From: André Kutepow @ 2023-07-10 10:21 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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?
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: search_path for replica-mode
@ 2023-07-10 13:11 David G. Johnston <david.g.johnston@gmail.com>
parent: André Kutepow <a.kutepow@prodat-sql.de>
0 siblings, 1 reply; 4+ messages in thread
From: David G. Johnston @ 2023-07-10 13:11 UTC (permalink / raw)
To: André Kutepow <a.kutepow@prodat-sql.de>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On Monday, July 10, 2023, André Kutepow <a.kutepow@prodat-sql.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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: search_path for replica-mode
@ 2023-07-11 08:50 André Kutepow <a.kutepow@prodat-sql.de>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: André Kutepow @ 2023-07-11 08:50 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Thanks David G. Johnston
Am 10.07.2023 um 15:11 schrieb David G. Johnston:
> On Monday, July 10, 2023, André Kutepow <a.kutepow@prodat-sql.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.
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-07-11 08:50 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-10 08:27 search_path for replica-mode André Kutepow <isaev.mail@mail.ru>
2023-07-10 10:21 search_path for replica-mode André Kutepow <a.kutepow@prodat-sql.de>
2023-07-10 13:11 ` David G. Johnston <david.g.johnston@gmail.com>
2023-07-11 08:50 ` André Kutepow <a.kutepow@prodat-sql.de>
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