%ROWTYPE输入参数类型
atlasdb=# create table ttt(a int);
CREATE TABLE
atlasdb=# CREATE OR REPLACE FUNCTION test_func_rowtype(ttt%rowtype)
atlasdb-# RETURNS int AS $$
atlasdb$# BEGIN
atlasdb$# raise notice '%', $1;
atlasdb$# RETURN $1.a;
atlasdb$# END;
atlasdb$# $$ LANGUAGE plpgsql;
CREATE FUNCTION
atlasdb=# insert into ttt values (1);
INSERT 0 1
atlasdb=# DO $$
atlasdb$# DECLARE
atlasdb$# c ttt;
atlasdb$# BEGIN
atlasdb$# select * into c from ttt limit 1;
atlasdb$# raise notice '%' ,test_func_rowtype(c);
atlasdb$# END;
atlasdb$# $$ LANGUAGE plpgsql;
NOTICE: (1)
NOTICE: 1
DO
atlasdb=#