Say I have a PLPGSQL function
CREATE OR REPLACE FUNCTION function_name
RETURNS TRIGGER AS ...
BEGIN
PERFORM
1
FROM
table1 t1
JOIN
table2 t2 USING( column_name )
WHERE
t1.column_name = NEW.column_name;
RETURN NEW;
END;
DROP TRIGGER IF EXISTS trigger_name
ON table1;
CREATE TRIGGER trigger_name
BEFORE INSERT ON table1
FOR EACH ROW EXECUTE PROCEDURE function_name;
I noticed that only some columns in
table1
andtable2
are accessible withNEW.column_name
. How can I see the full list of columns I can access withNEW
?Additionally, if there is a column in
table1
ortable2
that I cannot access withNEW
, how can I make it accessible toNEW
?