pg_vectorize icon indicating copy to clipboard operation
pg_vectorize copied to clipboard

drop table event triggers for vectorize.jobs

Open ChuckHend opened this issue 1 year ago • 0 comments

if a table is dropped that is part of vectorize.jobs, then the vectorize.job should also be deleted.

an event trigger can solve this. some scratch code as example of the idea

CREATE OR REPLACE FUNCTION after_drop_trigger()
RETURNS event_trigger AS $$
BEGIN
    DELETE FROM vectorize.job WHERE table_name = TG_TABLE_NAME;
END;
$$ LANGUAGE plpgsql;
CREATE EVENT TRIGGER trg_after_drop
ON sql_drop
WHEN TAG IN ('DROP TABLE')
EXECUTE FUNCTION after_drop_trigger();

ChuckHend avatar Oct 11 '24 04:10 ChuckHend