On Mon, Mar 5, 2012 at 6:52 AM, <rene(dot)vanpaassen(at)gmail(dot)com> wrote:
>
> set search_path to public;
>
> CREATE FUNCTION countusers()
> RETURNS INT
> AS $PROC$
> BEGIN
> RETURN count(*) FROM users;
> END
> $PROC$ LANGUAGE 'plpgsql' VOLATILE;
>
i think you can workaround your problem using EXECUTE:
CREATE FUNCTION countusers()
RETURNS INT
AS $PROC$
DECLARE
counter INT;
BEGIN
EXECUTE 'SELECT count(*) FROM users' INTO counter;
RETURN counter;
END
$PROC$ LANGUAGE 'plpgsql' VOLATILE;
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación