Re: select exact term

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
Cc: Craig James <cjames(at)emolecules(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: select exact term
Date: 2013-03-28 20:06:59
Message-ID: 22453.1364501219@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu> writes:
> I am struggling with the syntax. In php I create my where clause as shown, using ~* for case insensitive:
> $search = "art";
> $strSQL2 = "WHERE (title ~* [[:<:]]'$search'[[:>:]] OR description ~* [[:<:]]'$search'[[:>:]]) ";

> When executed zero records are returned even though the ILIKE statement shown below returns records that do have the word art.

Your php app must not be bothering to check for errors :-( ... that's
invalid SQL syntax. The bracket constructs are part of the regexp
string and need to be inside the single quotes.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Marc Fromm 2013-03-28 20:30:16 Re: select exact term
Previous Message Marc Fromm 2013-03-28 19:02:16 Re: select exact term