relcache引用不属于资源所有者TopTransaction

时间:2018-08-16 02:36:49

标签: postgresql pipelinedb

我在pipelinedb(基于postgresql 9.5.3)中创建了一个连续的Trasformer,以捕获设备状态代码已更改的数据。 然后这个CONTINUOUS TRANSFORM将调用一个函数(触发器), 在该函数中,代码根据设备状态代码的变化计算设备状态变化的时间范围,并将其写入表中。 功能中的操作包含选择/更新/插入。 在运行期间,我在数据库日志中发现了很多错误消息,但是这些错误似乎并不影响代码的正常执行。 但是,我仍然担心当我继续在数据库中收到此错误时会发生的坏事。

8月12日03:38:44 tst-gp5-srv3管道[19296]:[141958-1] 错误:relcache引用ct_rtd_his_narrow_func_fs不属于资源所有者TopTransaction 8月12日03:38:44 tst-gp5-srv3管道[19296]:[141958-2]声明:ct_rtd_his_narrow_func_fs

CREATE OR REPLACE FUNCTION chr.f_modify_mn_ver_fs()
  RETURNS trigger AS
  $$
  DECLARE
      v_rowcount  int;
  BEGIN
     IF COALESCE(NEW.new_dev,'') <> COALESCE(NEW.old_dev,'') THEN
        SELECT count(1) INTO v_rowcount FROM chr.t_mn_ver_fs WHERE mn_code=NEW.mn_code AND ver_type='dev' AND is_current='Y';
        IF v_rowcount > 0 THEN
            UPDATE chr.t_mn_ver
                  SET end_time = NEW.arvl_time,
                      is_current = 'N',
                      update_time = clock_timestamp()
                  WHERE mn_code = NEW.mn_code
                  AND ver_type='dev'
                  AND is_current = 'Y';
        END IF;

INSERT INTO chr.t_mn_ver_fs (mn_code, ver_type, ver, begin_time, end_time, is_current, insert_time) VALUES (NEW.mn_code, 'dev', NEW.new_sver, NEW.arvl_time, NULL, 'Y', clock_timestamp()); END IF; IF COALESCE(NEW.new_usg,'') <> COALESCE(NEW.old_usg,'') THEN SELECT count(1) INTO v_rowcount FROM chr.t_mn_ver_fs WHERE mn_code=NEW.mn_code AND ver_type='usg' AND is_current='Y'; IF v_rowcount > 0 THEN UPDATE chr.t_mn_ver_fs SET end_time = NEW.arvl_time, is_current = 'N', update_time = clock_timestamp() WHERE mn_code = NEW.mn_code AND ver_type='usg' AND is_current = 'Y'; END IF; INSERT INTO chr.t_mn_ver_fs (mn_code, ver_type, ver, begin_time, end_time, is_current, insert_time) VALUES (NEW.mn_code, 'usg', NEW.new_usg, NEW.arvl_time, NULL, 'Y', clock_timestamp()); END IF; IF COALESCE(NEW.new_sver,'') <> COALESCE(NEW.old_sver,'') THEN SELECT count(1) INTO v_rowcount FROM chr.t_mn_ver_fs WHERE mn_code=NEW.mn_code AND ver_type='sver' AND is_current='Y'; IF v_rowcount > 0 THEN UPDATE chr.t_mn_ver_fs SET end_time = NEW.arvl_time, is_current = 'N', update_time = clock_timestamp() WHERE mn_code = NEW.mn_code AND ver_type='sver' AND is_current = 'Y'; END IF; INSERT INTO chr.t_mn_ver_fs (mn_code, ver_type, ver, begin_time, end_time, is_current, insert_time) VALUES (NEW.mn_code, 'sver', NEW.new_sver, NEW.arvl_time, NULL, 'Y', clock_timestamp()); END IF; IF COALESCE(NEW.new_hver,'') <> COALESCE(NEW.old_hver,'') THEN SELECT count(1) INTO v_rowcount FROM chr.t_mn_ver_fs WHERE mn_code=NEW.mn_code AND ver_type='hver' AND is_current='Y'; IF v_rowcount > 0 THEN UPDATE chr.t_mn_ver SET end_time = NEW.arvl_time, is_current = 'N', update_time = clock_timestamp() WHERE mn_code = NEW.mn_code AND ver_type='hver' AND is_current = 'Y'; END IF; INSERT INTO chr.t_mn_ver_fs (mn_code, ver_type, ver, begin_time, end_time, is_current, insert_time) VALUES (NEW.mn_code, 'hver', NEW.new_hver, NEW.arvl_time, NULL, 'Y', clock_timestamp()); END IF; RETURN NEW; END; $$ LANGUAGE plpgsql;

1 个答案:

答案 0 :(得分:0)

有关此问题,请参见GitHub问题:

https://github.com/pipelinedb/pipelinedb/issues/1947