... forgot the most import issue The problem shows when the selection is from a view. The where condition does not have names contention. It is: select count(*) into <var> from <view_name> where <cond> -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general