首页 > 解决方案 > 发生事情时调用过程

问题描述

我只想知道我是否可以在发生某些事情时自动调用一个过程。特别是,当 now() 时间戳超过记录的时间戳属性一个月时,我想调用一个从表中删除记录的函数。就像是

create or replace procedure eliminate_when_time_past()
  as $$
    begin
      if (now() is one month past the record timestamp) then
          delete from preñadas where hierro = ...
      end if;
    end;
  $$
language plpgsql

可能吗?

标签: postgresql

解决方案


推荐阅读