help using count in function - Mailing list pgsql-novice

From Michaud, Everett
Subject help using count in function
Date
Msg-id 90727F03D504CE4E8CDB7F0F87330F65692077@miahcemail2.seqnt.com
Whole thread Raw
Responses Re: help using count in function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: help using count in function  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice

Perhaps this is simple, but it has me stumped.  What is the data type to use for returning a value from count?

Example:

 

CREATE FUNCTION ev3(int4) RETURNS int4
       AS 'Select count(id) from events where id = $1;' LANGUAGE 'sql';

 

ERROR:  return type mismatch in function declared to return integer

 

I’ve tried this with text, character, numeric, etc.  Nothing seems to work. 

Any ideas?

Thanks,

Ev

pgsql-novice by date:

Previous
From:
Date:
Subject: psql question
Next
From: "Sample, Matt (GE Healthcare)"
Date:
Subject: Bulk Loading into posgres 8.0.0