Re: Count(*) throws error - Mailing list pgsql-general

From Rodrigo De León
Subject Re: Count(*) throws error
Date
Msg-id 1184188891.122008.91960@d55g2000hsg.googlegroups.com
Whole thread Raw
In response to Count(*) throws error  ("Jasbinder Singh Bali" <jsbali@gmail.com>)
List pgsql-general
On Jul 11, 4:00 pm, jsb...@gmail.com ("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


pgsql-general by date:

Previous
From: aklaver@comcast.net (Adrian Klaver)
Date:
Subject: Re: Count(*) throws error
Next
From: Bohdan.Linda
Date:
Subject: Re:[GENERAL] auditing question - PARTIALY SOLVED