pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Regexps -- too complex?
3+ messages / 2 participants
[nested] [flat]

* Regexps -- too complex?
@ 2001-04-26 10:54  Emils Klotins <emils@grafton.lv>
  0 siblings, 2 replies; 3+ messages in thread

From: Emils Klotins @ 2001-04-26 10:54 UTC (permalink / raw)
  To: pgsql-sql

Running 7.0.2 on Alpha/RedHat 6.2 256MB RAM

In order to implement a fulltext search, I have a func that parses list 
of words and creates a regexp query with things like [[:<:]]( word | 
word | ... )[[:>:]]

That query then is passed to backend...

Now the strange thing:

gamenet=# SELECT id, title,publishdate,categoryid FROM articles WHERE translate(title,'abcdefghijklmnopqrstuvwxyzâèçìîíïòðûþõäöü','ABCDEFGHIJKLMNOPQRSTUVWXYZÂÈÇÌÎÍÏÒÐÛÞÕÄÖÜ') ~ '(BLACK|SERIOUS|SAM)[[:>:]]'::text ;
  id  |                      title                      | publishdate | categoryid
------+-------------------------------------------------+-------------+------------
  600 | Serious Sam ceïâ pie pircçjiem                  | 2001-03-22  |        149
  523 | Black & White gaidîðanas svçtki                 | 2001-03-19  |        155
  241 | Lorgaine: The Black Standard - íeltu varoòeposs | 2001-02-27  |        155
  707 | Lorgaine: The Black Standard beta versija       | 2001-03-23  |        156
 1484 | Black&White tomçr neesot spiegu programma   | 2001-04-18  |        155
 1490 | Black & White FAQ                               | 2001-04-18  |        160
 1496 | Black & White "ïaunais" FAQ                     | 2001-04-18  |        160
 1732 | Black & White - pârdotâkâ spçle ASV             | 2001-04-24  |        155
(8 rows)


gamenet=# SELECT id, title,publishdate,categoryid FROM articles WHERE translate(title,'abcdefghijklmnopqrstuvwxyzâèçìîíïòðûþõäöü','ABCDEFGHIJKLMNOPQRSTUVWXYZÂÈÇÌÎÍÏÒÐÛÞÕÄÖÜ') ~ '(BLACK|SERIOUS|WHITE|SAM)[[:>:]]'::text ;
 id | title | publishdate | categoryid
----+-------+-------------+------------
(0 rows)


It seems that if the regexp is too complex (more than 3 |-ed 
elements) it doesnt return.

Any ideas?




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Regexps -- too complex?
@ 2001-04-26 13:31  Emils Klotins <emils@grafton.lv>
  parent: Emils Klotins <emils@grafton.lv>
  1 sibling, 0 replies; 3+ messages in thread

From: Emils Klotins @ 2001-04-26 13:31 UTC (permalink / raw)
  To: Vladimir Terziev <vlady@rila.bg>; +Cc: pgsql-sql

> SELECT id, title,publishdate,categoryid FROM articles WHERE
> upper(title) ~ '(BLACK|SERIOUS|SAM)[[:>:]]'::text ;
> 
> I think the proiblem is in trnsalte, not in regexp
> 
> If you have installed apprporiate character encoding in Postgres,
> 'upper' will work!
> 
>  Vladimir

Thanks for the advice, unfortunately, it does not seem to work that 
way.


CREATE TABLE "test" (
        "title" text
);
COPY "test" FROM stdin;
Serious Sam ceïâ pie pircçjiem
Black & White gaidîðanas svçtki
Lorgaine: The Black Standard - íeltu varoòeposs
Lorgaine: The Black Standard beta versija
Black&White tomçr neesot spiegu programma
Black & White FAQ
Black & White "ïaunais" FAQ
Black & White - pârdotâkâ spçle ASV
\.


SELECT title FROM test WHERE title ~ '(BLACK|WHITE|SAM)';

yields 8 rows.

SELECT title FROM test WHERE title ~ 
'(BLACK|WHITE|blahblah|SAM)'; 

yields 0 rows!

SELECT title FROM test WHERE title ~ '(BLACK|WHITE|SAM) *'; 
also yields 0 rows!


I dont think this is right no matter what the characters I am using 
there. At least it shouldn't, should it?

Emils



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Regexps -- too complex?
@ 2001-04-26 14:45  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Emils Klotins <emils@grafton.lv>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2001-04-26 14:45 UTC (permalink / raw)
  To: Emils Klotins <emils@grafton.lv>; +Cc: pgsql-sql

"Emils Klotins" <emils@grafton.lv> writes:
> Running 7.0.2 on Alpha/RedHat 6.2 256MB RAM

Update to 7.1.  7.0.* has a lot of portability problems on Alphas,
and one of them is that regexps with between 33 and 64 states don't
work (int vs long problem...)

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-04-26 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-26 10:54 Regexps -- too complex? Emils Klotins <emils@grafton.lv>
2001-04-26 13:31 ` Emils Klotins <emils@grafton.lv>
2001-04-26 14:45 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox