0
다음 함수 update_sessioninfo()는 변경된 열만 업데이트해야합니다. . 새로운 * 열이 실행 한 후 일부 잘못된 값으로 갱신됩니다업데이트 후 postgresql 트리거
update freeradius.radacct set acctsessiontime=25 where radacctid=3;
기능
CREATE OR REPLACE FUNCTION update_sessioninfo() RETURNS trigger AS $radacct_update$
BEGIN
-- update the updated records
update freeradius.day_guiding_usage set acctstoptime=New.acctstoptime,acctsessiontime=New.acctsessiontime,connectinfo_start=New.connectinfo_start,connectinfo_stop=New.connectinfo_stop,acctinputoctets=New.acctinputoctets,acctoutputoctets=New.acctoutputoctets,acctterminatecause=New.acctterminatecause where acctsessionid=Old.acctsessionid;
RETURN NULL;
END;
$radacct_update$ LANGUAGE plpgsql;
트리거가
CREATE TRIGGER radacct_update AFTER UPDATE ON freeradius.radacct
FOR EACH ROW
WHEN (OLD.* IS DISTINCT FROM NEW.*)
EXECUTE procedure update_sessioninfo();
_The 새로운 * 열이 일부 잘못된 values_으로 갱신됩니다. 함수는 *'새로운 제품을 분해, 개조하지 않는'그리고 그것은 AFTER의 UPDATE 아니에요 어쨌든 수 있기 때문에 트리거 (값을 변경하기에는 너무 늦음). 자체적으로이 함수는 정상적으로 보이므로 무엇이 예상되고 대신 무엇이 얻어지는 지 명확하지 않습니다. –