Thread: search_path for replica-mode
There is a trigger in the database
But, if I announce it, as:
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?
SET search_path TO "$user", public;In a regular trigger, it works great!
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();
But, if I announce it, as:
ALTER TABLE art ENABLE REPLICA TRIGGER art__a_iu;FEHLER: Relation »table_z« existiert nicht bei Zeichen xxx
then I get an error:
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?
On Monday, July 10, 2023, André Kutepow <a.kutepow@prodat-sql.de> wrote:
There is a trigger in the databaseSET search_path TO "$user", public;In a regular trigger, it works great!
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();
But, if I announce it, as:ALTER TABLE art ENABLE REPLICA TRIGGER art__a_iu;FEHLER: Relation »table_z« existiert nicht bei Zeichen xxx
then I get an error:
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.
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 databaseSET search_path TO "$user", public;In a regular trigger, it works great!
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();
But, if I announce it, as:ALTER TABLE art ENABLE REPLICA TRIGGER art__a_iu;FEHLER: Relation »table_z« existiert nicht bei Zeichen xxx
then I get an error:
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.