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 4A8E28B9DFF for ; Sun, 13 Feb 2005 04:07:41 +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 71539-02 for ; Sun, 13 Feb 2005 04:07:40 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6AB878BA019 for ; Sun, 13 Feb 2005 04:07:33 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1D47XYM025709; Sat, 12 Feb 2005 23:07:33 -0500 (EST) To: b t Cc: pgsql-interfaces@postgresql.org Subject: Re: How to write UDF in C that resemble the LIKE function In-reply-to: <20050213034017.95691.qmail@web61004.mail.yahoo.com> References: <20050213034017.95691.qmail@web61004.mail.yahoo.com> Comments: In-reply-to b t message dated "Sat, 12 Feb 2005 19:40:17 -0800" Date: Sat, 12 Feb 2005 23:07:32 -0500 Message-ID: <25708.1108267652@sss.pgh.pa.us> From: Tom Lane 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/52 X-Sequence-Number: 5297 b t writes: > I have a question, as part of the project that I have to do for > school, we have to implement a User Define Function in C that is > similar like the LIKE funtion in PostgreSQL. For example where a > customer is searching for an actor whose last name sounds like > "Schwarseneger" (notice the typo). However, the customer is not sure > neither about the spelling nor the pronunciation. The real star name > should be "Schwarzenegger". In this case, the "LIKE" operator in SQL > is not capable enough. It would be nice if the search would match last > names "similar to" "Schwarseneger". Can Some one please give me some > pointer on this or even sample code that you might have > implemented. So basically the thing that I'm doing is like a spell > check system where it return the closest match to the word. Didn't your professor notice that there are two or three of those already in contrib/fuzzystrmatch? regards, tom lane