Jeff Eckermann <jeff(at)akira(dot)eckermann(dot)com> writes:
> extracts=# create function testfunc(text) returns int4 as '
> extracts'# select count (*) from dedcolo where equip_type = ''$1'' --- That's doubled single quotes
> extracts'# ' language 'sql';
> CREATE
That's looking for rows where equip_type = '$1' ... ie, the literal
string $1. What you probably wanted is
create function testfunc(text) returns int4 as '
select count (*) from dedcolo where equip_type = $1
' language 'sql';
regards, tom lane