On Jul 11, 4:00 pm, jsb...@xxxxxxxxx ("Jasbinder Singh Bali") wrote: > I don't know why isn't count(*) working Works for me: create table tbl_concurrent(a int); insert into tbl_concurrent values (1); insert into tbl_concurrent values (9); insert into tbl_concurrent values (4); create or replace function foo() returns int as $$ declare no_rows int := 0; begin select into no_rows count(*) from tbl_concurrent; return no_rows; end; $$ language plpgsql; select foo(); foo ----- 3