Mike Plemmons wrote:
> I am trying to run this function but the return is not correct. If I run the
> select statement from the psql command line it works. My guess is that the
> WHERE clause could be causing the problem. Then again, it may be how I am
> using the FOR loop. The ides column is of type TEXT.
> FOR myrec IN SELECT * FROM tblStuff WHERE ides LIKE '%$1%' LOOP
You're assuming plpgsql does variable interpolation in a similar way to
Perl/shell etc. It doesn't. You'll want something like: ...LIKE '%' || $1 || '%'
-- Richard Huxton Archonet Ltd