Re: Problem with LIKE in a SQL function - Mailing list pgsql-novice

From Tom Lane
Subject Re: Problem with LIKE in a SQL function
Date
Msg-id 26426.1036167120@sss.pgh.pa.us
Whole thread Raw
In response to Problem with LIKE in a SQL function  (Mole <mole@zebra.co.uk>)
List pgsql-novice
Mole <mole@zebra.co.uk> writes:
> mail_db=# CREATE FUNCTION "user_id_funct_p2"(varchar)
> mail_db-# RETURNS setof varchar AS '
> mail_db'# SELECT "mailbox" FROM "user" WHERE "mailbox" LIKE (\'$1%\') '
> mail_db-# LANGUAGE sql ;

I think you want:

SELECT "mailbox" FROM "user" WHERE "mailbox" LIKE ($1 || \'%\') '

            regards, tom lane

pgsql-novice by date:

Previous
From: Mole
Date:
Subject: Problem with LIKE in a SQL function
Next
From: Garrett Bladow
Date:
Subject: Re: Problem with LIKE in a SQL function