Re: pattern search

From: Scott Marlowe <scott(dot)marlowe(at)ihs(dot)com>
To: ktt <kestutis98(at)yahoo(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: pattern search
Date: 2002-05-23 18:09:10
Message-ID: Pine.LNX.4.33.0205231201450.7477-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes, you can.

What you do is something like this:

$nugget = "smith";
$res = pg_exec($conn,"select * from table where lower(field) like
'%$nugget%'");
print implode(":",pg_fetch_array($res,0,PGSQL_ASSOC));

For large datasets, there are some issues with performance that can be
addressed by indexing or using the included full text index system
included in the postgresql-7.x.x/contrib/fulltextindex directory.

It's far better to do the search in postgresql than to suck all the data
into php and try to sort through it.

On Thu, 23 May 2002, ktt wrote:

> hello,
>
> is it possible to make a search
> for a pattern in PostgreSQL database,
> using database functions only?
> Or should I use PHP for that
> purpose?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fran Fabrizio 2002-05-23 18:16:53 Re: Violation of NOT NULL
Previous Message Jeff Eckermann 2002-05-23 17:55:24 Re: pattern search