From: | "Maksim Likharev" <mlikharev(at)aurigin(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: TABLE FUNCTION, ERROR: WRONG RECORD TYPE IN RETURN NEXT |
Date: | 2003-06-11 23:53:38 |
Message-ID: | 56510AAEF435D240958D1CE8C6B1770A014A0C4F@mailc03.aurigin.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ok, found what the problem is, count() aggregate returns bigint.
-----Original Message-----
From: Maksim Likharev
Sent: Wednesday, June 11, 2003 4:37 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] TABLE FUNCTION, ERROR: WRONG RECORD TYPE IN RETURN
NEXT
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;
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | Jay O'Connor | 2003-06-12 00:07:49 | Re: need a method to ping a running database |
Previous Message | Octavio Alvarez | 2003-06-11 23:40:42 | LC_COLLATE=es_MX in PgSQL 7.3.2 |