2
It is possible to create an Insert Trigger in a "Table1" using "CREATE TEMP TABLE" in its structure and feed a "Table2"?
2
It is possible to create an Insert Trigger in a "Table1" using "CREATE TEMP TABLE" in its structure and feed a "Table2"?
0
I don’t quite understand what you want to do, but you can create time tables in your Rigger.
Ex:
CREATE OR REPLACE FUNCTION f_table1_tbi() RETURNS TRIGGER AS $$
BEGIN
CREATE TEMPORARY TABLE table2 ON COMMIT DROP AS
SELECT NEW.*;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER table1_tbi BEFORE INSERT
ON table1 FOR EACH ROW EXECUTE PROCEDURE f_table1_tbi();
In this case the table2 time table will be deleted when executing the commit.
Browser other questions tagged sql postgresql trigger
You are not signed in. Login or sign up in order to post.
You can update the question by adding more details about the result you want to get?
– bruno