Re: select exact term

From: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: select exact term
Date: 2013-03-28 20:30:16
Message-ID: 93361C67E4EE844A80935863A4FF4B6C0632FCB9@Exch2010MB-2.univ.dir.wwu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Tom, I just discovered that. I reworked the php so the quotes surround the regexp.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Thursday, March 28, 2013 1:07 PM
To: Marc Fromm
Cc: Craig James; pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] select exact term

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

Browse pgsql-admin by date

  From Date Subject
Next Message Sergey Konoplev 2013-03-29 00:06:43 Re: select exact term
Previous Message Tom Lane 2013-03-28 20:06:59 Re: select exact term