Re: Case insesnitive searches with postgres
| From: | kerry at noc dot suntrix dot com | Date: | Thu, 21 Sep 2000 14:04:05 +0000 |
| Subject: | Re: Case insesnitive searches with postgres | ||
| References: | 1 2 3 4 5 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3032@lists.php.net to get a copy of this message | ||
Ahhhh, now I have been enlightened. Thank you for all of your help.
Cheers!
Kerry
On Thu, Sep 21, 2000 at 01:49:28PM +1100 or thereabouts, john slee wrote:
> On Wed, Sep 20, 2000 at 09:09:04PM -0400, kerry@noc.suntrix.com wrote:
> > I tried your suggestion and I get the following error:
>
> > Warning: PostgresSQL query failed: ERROR: regcomp failed with error empty
> > (sub)expression in
> > /home/kerry/homepage/secondchance.php/list.php on line 45
> > An error occurred.
>
> > Would escaping like \"~*\" solve this issue or am I missing something?
>
> strange. possibly $author or $title is empty - check if it is, and if
> so don't insert the revelvant sql. something like this, perhaps:
>
> $sql = "SELECT title,author FROM books WHERE true";
> if ($title != "") $sql .= " AND title ~* '$title'";
> if ($author != "") $sql .= " AND author ~* '$author'";
> $result = pg_exec($conn,$sql);
>
> (the 'WHERE true' is just to make generating the sql less painful, and
> has no effect on the result)
>
> if this is indeed the problem, i'd report it as a bug to the postgresql
> developers, it looks like an annoying thing to have to cope with. i
> don't believe i've ever seen that error with psql 6.5.x though, what
> version are you using?
>
> j.
>
> --
> .----------+---------------------------------.
> |John Slee `-------. <indigoid@chirp.com.au>|
> |Chirp Web Design | http://www.chirp.com.au|
> |Phone 02 62301871 `--------. 02 62301515 Fax|
> `---------------------------+----------------'