CREATE TABLE abc.emp
(
empname TEXT NOT NULL,
salary INTEGER
);
CREATE TABLE abc.emp_audit
(
operation CHAR(1) NOT NULL,
stamp TIMESTAMP NOT NULL,
userid TEXT NOT NULL,
empname TEXT NOT NULL,
salary INTEGER
);
CREATE FUNCTION abc.audit()
returns TRIGGER AS $$ ...
EXECUTE format
( 'INSERT INTO %I SELECT ''I'', current_timestamp, %L, ($1::%I.%I).*',
tg_argv[0], CURRENT_USER, tg_table_schema, tg_table_name ) using new;
... $$;
CREATE TRIGGER emp_audit_trig after
INSERT
OR
UPDATE
OR
DELETE
ON abc.emp FOR each row
EXECUTE FUNCTION
abc.audit('abc.emp_audit');
I got error : Relation "abc.emp_audit" does not exist . How to correct this issue when schema added in tables ad audit tables, functions, and triggers arguments.