我需要与其他服务器连接,但是此连接出现以下错误。示例代码。
CREATE OR REPLACE FUNCTION attBD()
RETURNS TRIGGER AS
$attBD$
BEGIN
SELECT dblink_connect('myconect', 'hostaddr=***.**.**.** port=5432 dbname=postgres user=postgres password=***');
IF ( TG_OP = 'SELECT') THEN
SELECT * FROM DBLINK
('myconect', 'select*from teste_GB')
as func2 (id Integer,
nome varchar);
RETURN NEW;
ELSE IF (TG_OP = 'INSERT') THEN
SELECT dblink_exec
('myconect',
'INSERT INTO teste.teste_replica(id, nome,)
VALUES
(new.id, new.nome)');
RETURN NEW;
ELSE IF ( TG_OP = 'UPDATE' ) THEN
SELECT dblink_exec
('myconect',
'UPDATE teste.teste_replica SET id=new.id , nome= new.nome,
WHERE id = new.id)');
RETURN NEW;
ELSE IF ( TG_OP = 'DELETE') THEN
SELECT dblink_exec
('myconect',
'DELETE from teste.teste_replica WHERE id = old.id');
RETURN OLD;
END IF; END IF; END IF; END IF;
RETURN NEW;
END;
$attBD$ LANGUAGE 'plpgsql';
运行代码时,出现以下消息: 错误:查询没有结果数据的目的地 提示:如果要放弃SELECT的结果,请改用PERFORM。 我该怎么办?