pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to search for a subString
7+ messages / 5 participants
[nested] [flat]

* How to search for a subString
@ 2005-02-06 10:12  b t <qtboyzz@yahoo.com>
  0 siblings, 2 replies; 7+ messages in thread

From: b t @ 2005-02-06 10:12 UTC (permalink / raw)
  To: pgsql-interfaces

Hi, I'm building a database for a school project and I want to search for the name of the movie,  fro example in the database there is a table called movie and has a movie call "The fast and the furious" so if the type in "the fast" then it should return that movie. I tried using like and ilike and it still would not work.
Thanks in advance
-BT

		
---------------------------------
Do you Yahoo!?
 Yahoo! Search presents - Jib Jab's 'Second Term'

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

* Re: [despammed] How to search for a subString
@ 2005-02-06 10:45  Kretschmer Andreas <andreas_kretschmer@despammed.com>
  parent: b t <qtboyzz@yahoo.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Kretschmer Andreas @ 2005-02-06 10:45 UTC (permalink / raw)
  To: pgsql-interfaces

am  Sun, dem 06.02.2005, um  2:12:46 -0800 mailte b t folgendes:
> Hi, I'm building a database for a school project and I want to search for the
> name of the movie,  fro example in the database there is a table called movie
> and has a movie call "The fast and the furious" so if the type in "the fast"
> then it should return that movie. I tried using like and ilike and it still

select .. ~ '*the fast*' ...


Regards, Andreas
-- 
Diese Message wurde erstellt mit freundlicher Unterstützung eines freilau-
fenden Pinguins aus artgerechter Freilandhaltung.   Er ist garantiert frei
von Micro$oft'schen Viren. (#97922 http://counter.li.org)     GPG 7F4584DA
Was, Sie wissen nicht, wo Kaufbach ist? Hier: N 51.05082°, E 13.56889° ;-)



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

* Re: [despammed] How to search for a subString
@ 2005-02-06 13:32  Bruno Wolff III <bruno@wolff.to>
  parent: Kretschmer Andreas <andreas_kretschmer@despammed.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Bruno Wolff III @ 2005-02-06 13:32 UTC (permalink / raw)
  To: Kretschmer Andreas <andreas_kretschmer@despammed.com>; +Cc: pgsql-interfaces

On Sun, Feb 06, 2005 at 11:45:20 +0100,
  Kretschmer Andreas <andreas_kretschmer@despammed.com> wrote:
> am  Sun, dem 06.02.2005, um  2:12:46 -0800 mailte b t folgendes:
> > Hi, I'm building a database for a school project and I want to search for the
> > name of the movie,  fro example in the database there is a table called movie
> > and has a movie call "The fast and the furious" so if the type in "the fast"
> > then it should return that movie. I tried using like and ilike and it still
> 
> select .. ~ '*the fast*' ...

That should be:
select .. ~ '.*the fast.*' ...

As REs are unanchored, you can simplify this to:
select .. ~ 'the fast' ...

However, ilike should have worked if it was used properly.

Also note that these searches are going to be slow, since they won't
be able to use an index. If you have so many movies that the speed of
the search is unacceptably slow, then you might want to look at the
tsearch2 contrib module.



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

* Re: [despammed] How to search for a subString
@ 2005-02-06 15:03  Frank Finner <postgresql@finner.de>
  parent: Bruno Wolff III <bruno@wolff.to>
  0 siblings, 2 replies; 7+ messages in thread

From: Frank Finner @ 2005-02-06 15:03 UTC (permalink / raw)
  To: Bruno Wolff III <bruno@wolff.to>; +Cc: andreas_kretschmer@despammed.com; pgsql-interfaces

Do REs automatically ignore case? Otherwise it is clear that ~ 'the
fast' cannot find 'The fast and the furious'. The search
expressions should be all uppercased or lowercased then.

Regards, Frank.

On Sun, 6 Feb 2005 07:32:20 -0600 Bruno Wolff III <bruno@wolff.to>
thought long, then sat down and wrote:

> As REs are unanchored, you can simplify this to:
> select .. ~ 'the fast' ...
>
> However, ilike should have worked if it was used properly.
-- 
Frank Finner
Köpfchenstraße 36
57072 Siegen


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

* Re: [despammed] How to search for a subString
@ 2005-02-06 15:11  Kretschmer Andreas <andreas_kretschmer@despammed.com>
  parent: Frank Finner <postgresql@finner.de>
  1 sibling, 0 replies; 7+ messages in thread

From: Kretschmer Andreas @ 2005-02-06 15:11 UTC (permalink / raw)
  To: pgsql-interfaces

am  Sun, dem 06.02.2005, um 16:03:48 +0100 mailte Frank Finner folgendes:
> Do REs automatically ignore case? Otherwise it is clear that ~ 'the

No.


> fast' cannot find 'The fast and the furious'. The search
> expressions should be all uppercased or lowercased then.

Correct.

~  : Case-sensitive
~* : ignore case

!~ and !~* are negative


Regards, Andreas
-- 
Diese Message wurde erstellt mit freundlicher Unterstützung eines freilau-
fenden Pinguins aus artgerechter Freilandhaltung.   Er ist garantiert frei
von Micro$oft'schen Viren. (#97922 http://counter.li.org)     GPG 7F4584DA
Was, Sie wissen nicht, wo Kaufbach ist? Hier: N 51.05082°, E 13.56889° ;-)



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

* Re: How to search for a subString
@ 2005-02-06 18:18  Darko Prenosil <Darko.Prenosil@finteh.hr>
  parent: b t <qtboyzz@yahoo.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Darko Prenosil @ 2005-02-06 18:18 UTC (permalink / raw)
  To: b t <qtboyzz@yahoo.com>; pgsql-interfaces

You probably did not use correct syntax for LIKE, try with 
SELECT * FROM movie WHERE name LIKE '%the%fast%';

In the future if You want help from this list, be more specific about the problem, send some example, error message or such, not just explanation: "It does not work !"

Regards !

  ----- Original Message ----- 
  From: b t 
  To: pgsql-interfaces@postgresql.org 
  Sent: Sunday, February 06, 2005 11:12 AM
  Subject: [INTERFACES] How to search for a subString


  Hi, I'm building a database for a school project and I want to search for the name of the movie,  fro example in the database there is a table called movie and has a movie call "The fast and the furious" so if the type in "the fast" then it should return that movie. I tried using like and ilike and it still would not work.
  Thanks in advance
  -BT


------------------------------------------------------------------------------
  Do you Yahoo!?
  Yahoo! Search presents - Jib Jab's 'Second Term'

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

* Re: [despammed] How to search for a subString
@ 2005-02-07 14:35  Bruno Wolff III <bruno@wolff.to>
  parent: Frank Finner <postgresql@finner.de>
  1 sibling, 0 replies; 7+ messages in thread

From: Bruno Wolff III @ 2005-02-07 14:35 UTC (permalink / raw)
  To: Frank Finner <postgresql@finner.de>; +Cc: andreas_kretschmer@despammed.com; pgsql-interfaces

On Sun, Feb 06, 2005 at 16:03:48 +0100,
  Frank Finner <postgresql@finner.de> wrote:
> Do REs automatically ignore case? Otherwise it is clear that ~ 'the
> fast' cannot find 'The fast and the furious'. The search
> expressions should be all uppercased or lowercased then.

No they don't. I missed that when following up to the previous suggestion.
You need to use the ~* operator instead of ~ to get case insensitive
regular expressions.



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


end of thread, other threads:[~2005-02-07 14:35 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-06 10:12 How to search for a subString b t <qtboyzz@yahoo.com>
2005-02-06 10:45 ` Kretschmer Andreas <andreas_kretschmer@despammed.com>
2005-02-06 13:32   ` Bruno Wolff III <bruno@wolff.to>
2005-02-06 15:03     ` Frank Finner <postgresql@finner.de>
2005-02-06 15:11       ` Kretschmer Andreas <andreas_kretschmer@despammed.com>
2005-02-07 14:35       ` Bruno Wolff III <bruno@wolff.to>
2005-02-06 18:18 ` Darko Prenosil <Darko.Prenosil@finteh.hr>

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