pg_vectorize
pg_vectorize copied to clipboard
drop table event triggers for vectorize.jobs
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();