FAQ

On Mon, Mar 5, 2012 at 6:52 AM, 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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 7 | next ›
Discussion Overview
grouppgsql-bugs @
categoriespostgresql
postedMar 5, '12 at 11:52a
activeMar 14, '12 at 8:22a
posts7
users4
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase