Re: help using count in function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michaud, Everett" <EMichaud(at)sequoianet(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: help using count in function
Date: 2004-10-31 06:51:54
Message-ID: 25135.1099205514@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Michaud, Everett" <EMichaud(at)sequoianet(dot)com> writes:
> Perhaps this is simple, but it has me stumped. What is the data type to
> use for returning a value from count?

int8, a/k/a bigint. Or if you really want to return int4, you could
cast the count() result to int4.

> ERROR: return type mismatch in function declared to return integer

I don't think any modern version of Postgres is that stingy with
information about this error. I get either

ERROR: return type mismatch in function: declared to return integer, returns bigint

or

ERROR: return type mismatch in function declared to return integer
DETAIL: Actual return type is bigint.

depending on which version I try.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2004-10-31 06:54:34 Re: help using count in function
Previous Message Tom Lane 2004-10-30 16:58:32 Re: Array Question