Re: Problem with LIKE in a SQL function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mole <mole(at)zebra(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problem with LIKE in a SQL function
Date: 2002-11-01 16:12:00
Message-ID: 26426.1036167120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Mole <mole(at)zebra(dot)co(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Garrett Bladow 2002-11-01 16:12:03 Re: Problem with LIKE in a SQL function
Previous Message Mole 2002-11-01 15:10:49 Problem with LIKE in a SQL function