X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 84EA98B9E09 for ; Sun, 6 Feb 2005 13:17:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15917-07 for ; Sun, 6 Feb 2005 13:17:39 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id B8C908B9E2A for ; Sun, 6 Feb 2005 13:17:39 +0000 (GMT) Received: (qmail 2204 invoked by uid 500); 6 Feb 2005 13:32:20 -0000 Date: Sun, 6 Feb 2005 07:32:20 -0600 From: Bruno Wolff III To: Kretschmer Andreas Cc: pgsql-interfaces@postgresql.org Subject: Re: [despammed] How to search for a subString Message-ID: <20050206133220.GB952@wolff.to> Mail-Followup-To: Kretschmer Andreas , pgsql-interfaces@postgresql.org References: <20050206101246.28648.qmail@web61003.mail.yahoo.com> <20050206104520.GA3405@kaufbach.delug.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050206104520.GA3405@kaufbach.delug.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/10 X-Sequence-Number: 5255 On Sun, Feb 06, 2005 at 11:45:20 +0100, Kretschmer Andreas 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.