在PostgreSQL,我有只需要调用dctUpdate
功能没有做一个整体的SQL语句的表的更新规则,因为SQL语句在实际进行功能。我知道调用函数的唯一方法是通过SELECT dctUpdate(windowId)
:PSQL:沉默函数调用的输出,或称它没有SELECT
create or replace function infoUpdate(windowId in numeric) returns void as $$
begin
if windowId is null then
update info_timestamp set timestamp = now();
else
update info_timestamp set timestamp = now() where window_id = windowId;
end if;
end;
$$ LANGUAGE plpgsql;
create or replace rule info_update_rule as on update to some_table do also select infoUpdate(NEW.window_id);
然而,在命令行中,当规则被触发,因为我在some_table
更新一排,我从一个调用SELECT
条款无用输出功能:
db=# update some_table set name = 'foobar' where window_id = 1;
infoupdate
-----------
(1 row)
UPDATE 1
有没有办法有info_update_rule
调用infoUpdate
功能,没有它显示虚输出?
你真的要设置** **所有在整个表中的时间戳'NOW()'如果只是新的'window_id'是NULL?你需要支持哪些版本的PostgreSQL? –
@mu:是的,我的意思是设置NULL时的所有时间戳,并且我支持PostgreSQL 9.0和更高 – Fred