| From: | Rodrigo De León <rdeleonp(at)gmail(dot)com> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Count(*) throws error | 
| Date: | 2007-07-11 21:21:31 | 
| Message-ID: | 1184188891.122008.91960@d55g2000hsg.googlegroups.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general pgsql-hackers | 
On Jul 11, 4:00 pm, jsb(dot)(dot)(dot)(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bohdan.Linda | 2007-07-11 21:34:00 | Re:[GENERAL] auditing question - PARTIALY SOLVED | 
| Previous Message | Adrian Klaver | 2007-07-11 21:14:46 | Re: Count(*) throws error | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2007-07-11 21:28:25 | Re: "Running readonly queried on PITR slaves" statusupdate | 
| Previous Message | Erik Jones | 2007-07-11 21:14:02 | Re: Count(*) throws error |