TABLE FUNCTION, ERROR: WRONG RECORD TYPE IN RETURN NEXT - Mailing list pgsql-general

From Maksim Likharev
Subject TABLE FUNCTION, ERROR: WRONG RECORD TYPE IN RETURN NEXT
Date
Msg-id 56510AAEF435D240958D1CE8C6B1770A016D2D39@mailc03.aurigin.com
Whole thread Raw
List pgsql-general
Hi,
I having some problem with table function that returns set of 'type',

Error says: Wrong record type supplied in return next, why it so?
Thanks.


type:
public.my_type ( name varchar(800), ncount int4, total int4 )

function:
CREATE FUNCTION public.doit() RETURNS SETOF public.my_type AS '
DECLARE
    rec       RECORD;
BEGIN
    FOR rec IN
        SELECT public.getname( fullname ) AS fullname,
            COUNT( userid ) AS ncount,
            ROUND(10000.0 * CAST( COUNT( userid ) AS bigint
) / 10000, 0) AS total
                ....
    LOOP
        RETURN NEXT rec;
    END LOOP;
    RETURN;
END;



pgsql-general by date:

Previous
From: Travis Hume
Date:
Subject: need a method to ping a running database
Next
From: "Octavio Alvarez"
Date:
Subject: LC_COLLATE=es_MX in PgSQL 7.3.2