Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group