Postgres function returning one record while I have many records?
问题 I have many records which my simple query returning but when i use function it just gives me first record, firstly i create my own data type using, CREATE TYPE my_type (usr_id integer , name varchar(30)); and my function is, CREATE OR REPLACE function test() returns my_type as $$ declare rd varchar := '21'; declare personphone varchar := NULL; declare result my_type; declare SQL VARCHAR(300):=null; DECLARE radiophone_clause text = ''; BEGIN IF rd IS NOT NULL then radiophone_clause = 'and pp