pattern search
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?
thank you for any advice,
ktt
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of ktt
Sent: Thursday, May 23, 2002 11:06 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] pattern searchhello,
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?
PG supports standard SQL LIKE syntax, as well as full regular expression
syntax. See the section in the document on string functions and pattern
matching for information.
- J
Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant
If you mean text pattern matching then it has regex capabilities
*~ i believe without checkiong the manual i m not sure.
Alternatiely you could also look at the like operater but regex is
probably what you want
HTH
Darren Ferguson
On Thu, 23 May 2002, ktt wrote:
Show quoted text
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?thank you for any advice,
ktt
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
You can do it with LIKE; PostgreSQL also supports
Regular Expression searches. Check out:
http://www.postgresql.org/idocs/index.php?functions-matching.html
--- ktt <kestutis98@yahoo.com> 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?thank you for any advice,
ktt
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com---------------------------(end of
broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
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:
Show quoted text
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?