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 [email protected]
Whole thread Raw
In response to Problem with LIKE in a SQL function  (Mole <[email protected]>)
List pgsql-novice
Mole <[email protected]> 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