BEGIN
if (TG_OP = 'INSERT') then
INSERT INTO table_1_audit_log (
table_1_id,
old_row_data,
new_row_data,
dml_type,
dml_timestamp
)
VALUES(
NEW.id,
null,
to_jsonb(NEW),
'INSERT',
CURRENT_TIMESTAMP
);
RETURN NEW;
elsif (TG_OP = 'UPDATE') then
INSERT INTO table_1_audit_log (
table_1_id,
old_row_data,
new_row_data,
dml_type,
dml_timestamp
)
VALUES(
NEW.id,
to_jsonb(OLD),
to_jsonb(NEW),
'UPDATE',
CURRENT_TIMESTAMP
);
RETURN NEW;
elsif (TG_OP = 'DELETE') then
INSERT INTO table_1_audit_log (
table_1_id,
old_row_data,
new_row_data,
dml_type,
dml_timestamp
)
VALUES(
OLD.id,
to_jsonb(OLD),
null,
'DELETE',
CURRENT_TIMESTAMP
);
RETURN OLD;
end if;
END;
SELECT amqp.publish(1, '', 'queu', 'messange')
ERROR: function amqp.publish(integer, unknown, unknown, unknown) does not exist
SELECT amqp.publish(1, ''::varchar, 'queu'::varchar, 'messange'::varchar)