request a new feature in fuzzystrmatch
Hi,
I am studying your levenshtein edit distance contribution in Postgresql.
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?
Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.
Thanks,
Liming
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
---------- Forwarded message ----------
From: Liming Hu <dawninghu@gmail.com>
Date: Thu, May 16, 2013 at 5:41 PM
Subject: request a new feature in fuzzystrmatch
To: pgsql-hackers@postgresql.org
Hi,
I am studying your levenshtein edit distance contribution in Postgresql.
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?
Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.
Thanks,
Liming
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Sent from my iPad
On 17-May-2013, at 6:11, Liming Hu <dawninghu@gmail.com> wrote:
Hi,
I am studying your levenshtein edit distance contribution in Postgresql.
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.
Could you give some use cases for the same, where the proposed feature does better than the current functionalities?
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hi Atri,
Thanks for the quick response.
levenshtein edit distance defines operations of: insertion, deletion, modification.
Levenshtein-Damerau edit distance defines operations of: insertion, deletion, modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).
In spelling checker/corrector, i.e.
levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.
In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice "Google automated search suggestions", they use
Levenshtein-Damerau.
Thanks,
Liming
On 5/17/2013 3:00 AM, Atri Sharma wrote:
Sent from my iPad
On 17-May-2013, at 6:11, Liming Hu <dawninghu@gmail.com> wrote:
Hi,
I am studying your levenshtein edit distance contribution in Postgresql.
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.Could you give some use cases for the same, where the proposed feature does better than the current functionalities?
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hi Atri,
I also talked to the author of fuzzystrmatch, he also thinks it is a
good feature.
Thanks,
Liming
On 5/17/2013 8:21 AM, Liming Hu wrote:
Hi Atri,
Thanks for the quick response.
levenshtein edit distance defines operations of: insertion, deletion,
modification.
Levenshtein-Damerau edit distance defines operations of: insertion,
deletion, modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).In spelling checker/corrector, i.e.
levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice "Google automated search suggestions", they use
Levenshtein-Damerau.Thanks,
Liming
On 5/17/2013 3:00 AM, Atri Sharma wrote:
Sent from my iPad
On 17-May-2013, at 6:11, Liming Hu <dawninghu@gmail.com> wrote:
Hi,
I am studying your levenshtein edit distance contribution in
Postgresql.Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.Could you give some use cases for the same, where the proposed
feature does better than the current functionalities?Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 8:51 PM, Liming Hu <dawninghu@gmail.com> wrote:
Hi Atri,
Thanks for the quick response.
levenshtein edit distance defines operations of: insertion, deletion,
modification.
Levenshtein-Damerau edit distance defines operations of: insertion,
deletion, modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).In spelling checker/corrector, i.e.
levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice "Google automated search suggestions", they use
Levenshtein-Damerau.
Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 5/17/2013 8:23 AM, Atri Sharma wrote:
On Fri, May 17, 2013 at 8:51 PM, Liming Hu <dawninghu@gmail.com> wrote:
Hi Atri,
Thanks for the quick response.
levenshtein edit distance defines operations of: insertion, deletion,
modification.
Levenshtein-Damerau edit distance defines operations of: insertion,
deletion, modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).In spelling checker/corrector, i.e.
levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice "Google automated search suggestions", they use
Levenshtein-Damerau.Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?Regards,
Atri
I know how to write the code, but just need approval of accepting into
the new version.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 8:56 PM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 8:23 AM, Atri Sharma wrote:
On Fri, May 17, 2013 at 8:51 PM, Liming Hu <dawninghu@gmail.com> wrote:
Hi Atri,
Thanks for the quick response.
levenshtein edit distance defines operations of: insertion, deletion,
modification.
Levenshtein-Damerau edit distance defines operations of: insertion,
deletion, modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).In spelling checker/corrector, i.e.
levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice "Google automated search suggestions", they use
Levenshtein-Damerau.Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?Regards,
Atri
I know how to write the code, but just need approval of accepting into the
new version.
Well, acceptance depends largely on the implementation and actual
benefit statistics. I would suggest implementing a basic version and
then demonstrating its potential benefits here. It will lead to
clearer ideas for us and lead to improvements in the implementation.
Regards,
Atri
--
Regards,
Atri
l'apprenant
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hello Liming,
Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?I know how to write the code, but just need approval of accepting into
the new version.Well, acceptance depends largely on the implementation and actual
benefit statistics. I would suggest implementing a basic version and
then demonstrating its potential benefits here. It will lead to
clearer ideas for us and lead to improvements in the implementation.
You can have a look at this page:
http://wiki.postgresql.org/wiki/Submitting_a_Patch
--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation
Liming Hu escribió:
Hi Atri,
I also talked to the author of fuzzystrmatch, he also thinks it is a
good feature.
Yeah, I heard our fuzzystrmatch module being talked down a decade ago
for not considering transpositions, so +1 for getting it patched.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 9:29 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
Liming Hu escribió:
Hi Atri,
I also talked to the author of fuzzystrmatch, he also thinks it is a
good feature.Yeah, I heard our fuzzystrmatch module being talked down a decade ago
for not considering transpositions, so +1 for getting it patched.
That is awesome then. The example Liming provided is itself pretty
interesting and promising.
Regards,
Atri
--
Regards,
Atri
l'apprenant
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Actually it is easy for me to just modify the code, and use it for me
case, I would like to contribute to the
community. I will write a basic implementation first.
On Fri, May 17, 2013 at 9:10 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
On Fri, May 17, 2013 at 9:29 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:Liming Hu escribió:
Hi Atri,
I also talked to the author of fuzzystrmatch, he also thinks it is a
good feature.Yeah, I heard our fuzzystrmatch module being talked down a decade ago
for not considering transpositions, so +1 for getting it patched.That is awesome then. The example Liming provided is itself pretty
interesting and promising.Regards,
Atri
--
Regards,Atri
l'apprenant
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?
Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: WM01d2cc72a1cc1d288ea0dfc2971e797e52167436cfb7f4bfc8672a75f42235a1d2b8c3f1d30bcc2e4a1e4af2ff7cca8e@asav-2.01.com
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().
I am working on it, I will make it this weekend project.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatch
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart
* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;
********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatible
Any one can help me on this? Thanks.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?
Regards,
Atri
--
Regards,
Atri
l'apprenant
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?
I did not run make install. I am running a stable postgresql in my
laptop, I do not
want to reinstall everything, just want to try this contribution. I am
afraid
reinstall it will destroy my configurations, and databases, just do not
want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/levenshtein.c
Thanks,
Liming
Regards,
Atri
--
Regards,Atri
l'apprenant
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/
You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?
Regards,
Atri
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?
Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.
********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8
any more suggestion?
Thanks,
Liming
Regards,
Atri
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8
Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect errors later on.
It seems that the functions you added are not being created in the database.Are you sure that you have modified the .SQL files correctly to create you functions as well,and that you are using the correct SQL files while installing?
Does this happen only with dameraulevenshteinnocompatible, or with every function that you added? Have you tried using one of the original functions of fuzzystrmatch,to ensure that the original functionalities are still working?
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect errors later on.It seems that the functions you added are not being created in the database.Are you sure that you have modified the .SQL files correctly to create you functions as well,and that you are using the correct SQL files while installing?
Does this happen only with dameraulevenshteinnocompatible, or with every function that you added? Have you tried using one of the original functions of fuzzystrmatch,to ensure that the original functionalities are still working?
it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.so
liming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48 fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14 fuzzystrmatch--unpackaged--1.1.sql
instead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
That's the problem.
Regards,
Atri
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Sent from my iPad
On 18-May-2013, at 12:07, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect errors later on.It seems that the functions you added are not being created in the database.Are you sure that you have modified the .SQL files correctly to create you functions as well,and that you are using the correct SQL files while installing?
Does this happen only with dameraulevenshteinnocompatible, or with every function that you added? Have you tried using one of the original functions of fuzzystrmatch,to ensure that the original functionalities are still working?
it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.soliming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48 fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14 fuzzystrmatch--unpackaged--1.1.sqlinstead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
The files will be copied to your pkglibdir path, which you can find by running pg_config --pkglibdir
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Sent from my iPad
On 18-May-2013, at 12:34, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:44 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 12:07, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect errors later on.It seems that the functions you added are not being created in the database.Are you sure that you have modified the .SQL files correctly to create you functions as well,and that you are using the correct SQL files while installing?
Does this happen only with dameraulevenshteinnocompatible, or with every function that you added? Have you tried using one of the original functions of fuzzystrmatch,to ensure that the original functionalities are still working?
it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.soliming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48 fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14 fuzzystrmatch--unpackaged--1.1.sqlinstead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.soThe files will be copied to your pkglibdir path, which you can find by running pg_config --pkglibdir
pg_config
You need to install postgresql-server-dev-X.Y for building a
server-side extension or libpq-dev for building a client-side
application.
(Please keep the list marked in your replies).
How did you install the Postgres instance you are trying to install the extension in? Did you use pre built binaries or make it from source?
Regards,
Atri
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: CAE-MfPudaGDdUU+E1KSKpoKrer-oS4H31B6_MOWxtew5USmeWQ@mail.gmail.com
On 5/18/2013 12:11 AM, Atri Sharma wrote:
Sent from my iPad
On 18-May-2013, at 12:34, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:44 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 12:07, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I do not
want to reinstall everything, just want to try this contribution. I am afraid
reinstall it will destroy my configurations, and databases, just do not want to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an extension.Running make install from the extension's directory(after placing it in /contrib of a postgres database source directory) will install the extension in your current database without breaking anything.
You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for ensuring that all runs well.
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect errors later on.
It seems that the functions you added are not being created in the database.Are you sure that you have modified the .SQL files correctly to create you functions as well,and that you are using the correct SQL files while installing?Does this happen only with dameraulevenshteinnocompatible, or with every function that you added? Have you tried using one of the original functions of fuzzystrmatch,to ensure that the original functionalities are still working?
it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.soliming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48 fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14 fuzzystrmatch--unpackaged--1.1.sqlinstead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.soThe files will be copied to your pkglibdir path, which you can find by running pg_config --pkglibdir
pg_config
You need to install postgresql-server-dev-X.Y for building a
server-side extension or libpq-dev for building a client-side
application.(Please keep the list marked in your replies).
How did you install the Postgres instance you are trying to install the extension in? Did you use pre built binaries or make it from source?
I am running ubuntu, I install postgresql from the ubuntu software center.
I directly copy those files, now it works.
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
1
thanks a lot.
Liming
Show quoted text
Regards,
Atri
On Sat, May 18, 2013 at 1:30 PM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/18/2013 12:11 AM, Atri Sharma wrote:
Sent from my iPad
On 18-May-2013, at 12:34, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:44 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 12:07, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I
do not
want to reinstall everything, just want to try this contribution. I am
afraid
reinstall it will destroy my configurations, and databases, just do not want
to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an
extension.Running make install from the extension's directory(after placing
it in /contrib of a postgres database source directory) will install the
extension in your current database without breaking anything.You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for
ensuring that all runs well.liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function
‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect
errors later on.It seems that the functions you added are not being created in the
database.Are you sure that you have modified the .SQL files correctly to
create you functions as well,and that you are using the correct SQL files
while installing?Does this happen only with dameraulevenshteinnocompatible, or with every
function that you added? Have you tried using one of the original functions
of fuzzystrmatch,to ensure that the original functionalities are still
working?it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.soliming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48 fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14 fuzzystrmatch--unpackaged--1.1.sqlinstead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.soThe files will be copied to your pkglibdir path, which you can find by
running pg_config --pkglibdirpg_config
You need to install postgresql-server-dev-X.Y for building a
server-side extension or libpq-dev for building a client-side
application.(Please keep the list marked in your replies).
How did you install the Postgres instance you are trying to install the
extension in? Did you use pre built binaries or make it from source?I am running ubuntu, I install postgresql from the ubuntu software center.
I directly copy those files, now it works.select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
1
thanks a lot.
Liming
Regards,
Atri
Awesome.
For reference, if you are using pre built binaries(as you are using),
you should install the client side applications and
postgresql-server-dev-X.Y as well.
Regards,
Atri
--
Regards,
Atri
l'apprenant
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 5/18/2013 1:03 AM, Atri Sharma wrote:
On Sat, May 18, 2013 at 1:30 PM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/18/2013 12:11 AM, Atri Sharma wrote:
Sent from my iPad
On 18-May-2013, at 12:34, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:44 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 12:07, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my laptop, I
do not
want to reinstall everything, just want to try this contribution. I am
afraid
reinstall it will destroy my configurations, and databases, just do not want
to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing an
extension.Running make install from the extension's directory(after placing
it in /contrib of a postgres database source directory) will install the
extension in your current database without breaking anything.You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for
ensuring that all runs well.liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function �damerau_levenshtein_internal�:
dameraulevenshtein.c:290:57: warning: unused variable �trans�
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable �trans�
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function �damerau_levenshtein_less_equal_internal�:
dameraulevenshtein.c:290:57: warning: unused variable �trans�
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable �trans�
[-Wunused-variable]
dameraulevenshtein.c: In function
�dameraulevenshtein_with_costs_noncompatible�:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function �damerau_levenshtein_with_costs_noncompatible�:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
�damerau_levenshtein_internal_noncompatible�
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: �dameraulevenshtein_internal�
declared �static� but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
�dameraulevenshtein_less_equal_internal� declared �static� but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
�dameraulevenshtein_with_costs_noncompatible� defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the configurations.
First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect
errors later on.It seems that the functions you added are not being created in the
database.Are you sure that you have modified the .SQL files correctly to
create you functions as well,and that you are using the correct SQL files
while installing?Does this happen only with dameraulevenshteinnocompatible, or with every
function that you added? Have you tried using one of the original functions
of fuzzystrmatch,to ensure that the original functionalities are still
working?it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.soliming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48 fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14 fuzzystrmatch--unpackaged--1.1.sqlinstead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.soThe files will be copied to your pkglibdir path, which you can find by
running pg_config --pkglibdirpg_config
You need to install postgresql-server-dev-X.Y for building a
server-side extension or libpq-dev for building a client-side
application.(Please keep the list marked in your replies).
How did you install the Postgres instance you are trying to install the
extension in? Did you use pre built binaries or make it from source?I am running ubuntu, I install postgresql from the ubuntu software center.
I directly copy those files, now it works.select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
1
thanks a lot.
Liming
Regards,
Atri
Awesome.
For reference, if you are using pre built binaries(as you are using),
you should install the client side applications and
postgresql-server-dev-X.Y as well.Regards,
Atri
--
Regards,Atri
l'apprenant
How to do that? Thanks.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, May 18, 2013 at 1:47 PM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/18/2013 1:03 AM, Atri Sharma wrote:
On Sat, May 18, 2013 at 1:30 PM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/18/2013 12:11 AM, Atri Sharma wrote:
Sent from my iPad
On 18-May-2013, at 12:34, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:44 PM, Atri Sharma <atri.jiit@gmail.com>
wrote:Sent from my iPad
On 18-May-2013, at 12:07, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma <atri.jiit@gmail.com>
wrote:Sent from my iPad
On 18-May-2013, at 11:23, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma <atri.jiit@gmail.com>
wrote:Sent from my iPad
On 18-May-2013, at 10:41, Liming Hu <dawninghu@gmail.com> wrote:
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma <atri.jiit@gmail.com> wrote:
Sent from my iPad
On 18-May-2013, at 10:00, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 9:10 PM, Atri Sharma wrote:
On Sat, May 18, 2013 at 9:27 AM, Liming Hu <dawninghu@gmail.com> wrote:
On 5/17/2013 12:39 PM, Liming Hu wrote:
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus <josh@agliodbs.com> wrote:
Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?Patches welcome! You, too, can be a PostgreSQL contributor.
However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility. Shouldn't
be hard, just add a new function called levenshtiend().I am working on it, I will make it this weekend project.
I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatchliming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart* Restarting PostgreSQL 9.1 database server
[ OK ]
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;********** Error **********
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so":
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatibleAny one can help me on this? Thanks.
The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?I did not run make install. I am running a stable postgresql in my
laptop, I
do not
want to reinstall everything, just want to try this contribution. I am
afraid
reinstall it will destroy my configurations, and databases, just do not
want
to mess up.
did you see any thing wrong:https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.chttps://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/You need not reinstall your entire database for installing/re installing
an
extension.Running make install from the extension's directory(after
placing
it in /contrib of a postgres database source directory) will install the
extension in your current database without breaking anything.You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?Yes,although,I would run make clean before running make install,just for
ensuring that all runs well.liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function
‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function
‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function
‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused-function]
dameraulevenshtein.c:464:12: warning:
‘dameraulevenshtein_with_costs_noncompatible’ defined but not used
[-Wunused-function]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -shared
-o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port
-Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/mkdir -p '/usr/local/pgsql/share/extension'
/bin/sh ../../config/install-sh -c -m 755 fuzzystrmatch.so
'/usr/local/pgsql/lib/fuzzystrmatch.so'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch.control
'/usr/local/pgsql/share/extension/'
/bin/sh ../../config/install-sh -c -m 644 ./fuzzystrmatch--1.0.sql
./fuzzystrmatch--unpackaged--1.0.sql
'/usr/local/pgsql/share/extension/'
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$After that:
CREATE EXTENSION fuzzystrmatch;
select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
LINE 1: select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.********** Error **********
ERROR: function dameraulevenshteinnocompatible(unknown, unknown,
integer, integer, integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might
need to add explicit type casts.
Character: 8Ok,so now, we are in issues with the code and possibly, the
configurations.First up, I would fix the warnings
that are being generated while compiling.Those may lead to hard to detect
errors later on.It seems that the functions you added are not being created in the
database.Are you sure that you have modified the .SQL files correctly to
create you functions as well,and that you are using the correct SQL files
while installing?Does this happen only with dameraulevenshteinnocompatible, or with every
function that you added? Have you tried using one of the original
functions
of fuzzystrmatch,to ensure that the original functionalities are still
working?it seems the make install command will copy fuzzystrmatch.so to:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
total 48
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 4 root root 4096 May 17 22:39 ..
-rwxr-xr-x 1 root root 40640 May 17 23:14 fuzzystrmatch.soliming@liming-UX31A:/usr/local/pgsql/share/extension$ ls -la
total 28
drwxr-xr-x 2 root root 4096 May 17 23:14 .
drwxr-xr-x 3 root root 4096 May 17 22:39 ..
-rw-r--r-- 1 root root 2250 May 17 22:48 fuzzystrmatch--1.0.sql
-rw-r--r-- 1 root root 2250 May 17 23:14 fuzzystrmatch--1.1.sql
-rw-r--r-- 1 root root 175 May 17 23:14 fuzzystrmatch.control
-rw-r--r-- 1 root root 1945 May 17 22:48
fuzzystrmatch--unpackaged--1.0.sql
-rw-r--r-- 1 root root 1945 May 17 23:14
fuzzystrmatch--unpackaged--1.1.sqlinstead of:
liming@liming-UX31A:/usr/local/pgsql/lib$ ls -la
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
-rw-r--r-- 1 root root 30520 May 17 19:50
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.soThe files will be copied to your pkglibdir path, which you can find by
running pg_config --pkglibdirpg_config
You need to install postgresql-server-dev-X.Y for building a
server-side extension or libpq-dev for building a client-side
application.(Please keep the list marked in your replies).
How did you install the Postgres instance you are trying to install the
extension in? Did you use pre built binaries or make it from source?I am running ubuntu, I install postgresql from the ubuntu software
center.
I directly copy those files, now it works.select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
1
thanks a lot.
Liming
Regards,
Atri
Awesome.
For reference, if you are using pre built binaries(as you are using),
you should install the client side applications and
postgresql-server-dev-X.Y as well.Regards,
Atri
--
Regards,Atri
l'apprenantHow to do that? Thanks.
Directly from sudo apt-get.
e.g. sudo apt-get install postgresql-server-dev-9.2
Or,you could probably search for them in Ubuntu Software Center.
Regards,
Atri
--
Regards,
Atri
l'apprenant
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, May 17, 2013 at 05:50:38PM +0200, Cédric Villemain wrote:
Hello Liming,
Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?I know how to write the code, but just need approval of accepting into
the new version.Well, acceptance depends largely on the implementation and actual
benefit statistics. I would suggest implementing a basic version and
then demonstrating its potential benefits here. It will lead to
clearer ideas for us and lead to improvements in the implementation.You can have a look at this page:
http://wiki.postgresql.org/wiki/Submitting_a_Patch
Also very important to look at for patch implementation and
communication:
http://wiki.postgresql.org/wiki/Working_with_Git
Cheers,
David (wondering whether we should provide specific instructions for
github, bitbucket, etc.).
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, May 18, 2013 at 6:38 PM, David Fetter <david@fetter.org> wrote:
On Fri, May 17, 2013 at 05:50:38PM +0200, Cédric Villemain wrote:
Hello Liming,
Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?I know how to write the code, but just need approval of accepting into
the new version.Well, acceptance depends largely on the implementation and actual
benefit statistics. I would suggest implementing a basic version and
then demonstrating its potential benefits here. It will lead to
clearer ideas for us and lead to improvements in the implementation.You can have a look at this page:
http://wiki.postgresql.org/wiki/Submitting_a_PatchAlso very important to look at for patch implementation and
communication:http://wiki.postgresql.org/wiki/Working_with_Git
Cheers,
David (wondering whether we should provide specific instructions for
github, bitbucket, etc.).
I have implemented the code according to Joe's suggestion, and put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1
Thanks,
Liming
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.icsRemember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Liming Hu escribi�:
I have implemented the code according to Joe's suggestion, and put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1
Please submit a proper patch so it can be seen on our mailing list
archives.
--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
Liming Hu escribió:
I have implemented the code according to Joe's suggestion, and put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can you please
help me on submit the
patch?
Thanks,
Liming
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Liming Hu <dawninghu@gmail.com> wrote:
I am kind of new to the Postgresql hacker community, Can you
please help me on submit the patch?
You might want to read this page:
http://wiki.postgresql.org/wiki/Developer_FAQ
In particular, the Development Process section has a link to
"Submitting a Patch" that you should read.
--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/11/2013 02:23 PM, Liming Hu wrote:
On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:Liming Hu escribi�:
I have implemented the code according to Joe's suggestion, and
put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1
Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can you
please help me on submit the patch?
Hi Liming,
I might be able to help, but it will be at least a couple of days
before I have the time to look at this,
Joe
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRt50oAAoJEDfy90M199hliukP/A8IZf7L0DcYWG/jZUttTg0M
yWpCz1KHZ7fAGqeJ5ddzuSx5CMjsmt2zYQ+0EfLX1ftoSxIHaFpSC49GgJHUdAoq
TSOOC1rfkfmNJG98WfUPH14Flq4eEl9reUZDXXi3jqol+npJdAQaEt9EM5y0qkcB
pDCy9iMaYdjYNV6RXFOBNI+7Up43oULbMLhWwwFnGX9AgCLk8SGRZHnfT1zOaXYE
bW/Dl9TIu058ENZqFFLIfjxqngE/Y61SOaLRAxEkbO7HAFkuwgQwnIayrasR29F+
GX4+HRcsd0jrcF858Dm4E+YAffI2quOR2HgZTGQj6jTNtRpb16+EI+X1vrYI3AH8
5tf3exq9FDL/02zlCpKm8+uXksaLzffQXlbQPw8uDlpk+ThD0uo2990/TC6QYgXO
o2vCu+nkWdTc2AUk4NkoVFwXaaFLZ+M8U+swRHNAShqH7VQVx8rRwubsRJ1msT3i
nC8BFyMsBzOmsKNwO0IM6ZcsJXaIpmMCUshF8cGDfgpsWUQ/wzovzopb+PSiEKQB
X45hWYtiK3tIvo0f9gvEWzRJ4+O8tmmIZzzWz127yBdugV0xjsEHnDihpjkeMPJx
WHs5ViN62u62r34UCtX1oiClCC+FYR0f//alh48VlXWzP7NkFt4dcKOD6ZCzSOeQ
udKM0QF2TNbUebj9QIpq
=W6Oy
-----END PGP SIGNATURE-----
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Tue, Jun 11, 2013 at 2:56 PM, Joe Conway <mail@joeconway.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 06/11/2013 02:23 PM, Liming Hu wrote:
On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:Liming Hu escribió:
I have implemented the code according to Joe's suggestion, and
put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can you
please help me on submit the patch?Hi Liming,
I might be able to help, but it will be at least a couple of days
before I have the time to look at this,Joe
ok, thanks, I will wait.
Liming
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/iQIcBAEBAgAGBQJRt50oAAoJEDfy90M199hliukP/A8IZf7L0DcYWG/jZUttTg0M
yWpCz1KHZ7fAGqeJ5ddzuSx5CMjsmt2zYQ+0EfLX1ftoSxIHaFpSC49GgJHUdAoq
TSOOC1rfkfmNJG98WfUPH14Flq4eEl9reUZDXXi3jqol+npJdAQaEt9EM5y0qkcB
pDCy9iMaYdjYNV6RXFOBNI+7Up43oULbMLhWwwFnGX9AgCLk8SGRZHnfT1zOaXYE
bW/Dl9TIu058ENZqFFLIfjxqngE/Y61SOaLRAxEkbO7HAFkuwgQwnIayrasR29F+
GX4+HRcsd0jrcF858Dm4E+YAffI2quOR2HgZTGQj6jTNtRpb16+EI+X1vrYI3AH8
5tf3exq9FDL/02zlCpKm8+uXksaLzffQXlbQPw8uDlpk+ThD0uo2990/TC6QYgXO
o2vCu+nkWdTc2AUk4NkoVFwXaaFLZ+M8U+swRHNAShqH7VQVx8rRwubsRJ1msT3i
nC8BFyMsBzOmsKNwO0IM6ZcsJXaIpmMCUshF8cGDfgpsWUQ/wzovzopb+PSiEKQB
X45hWYtiK3tIvo0f9gvEWzRJ4+O8tmmIZzzWz127yBdugV0xjsEHnDihpjkeMPJx
WHs5ViN62u62r34UCtX1oiClCC+FYR0f//alh48VlXWzP7NkFt4dcKOD6ZCzSOeQ
udKM0QF2TNbUebj9QIpq
=W6Oy
-----END PGP SIGNATURE-----
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Tue, Jun 11, 2013 at 3:19 PM, Liming Hu <dawninghu@gmail.com> wrote:
On Tue, Jun 11, 2013 at 2:56 PM, Joe Conway <mail@joeconway.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 06/11/2013 02:23 PM, Liming Hu wrote:
On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:Liming Hu escribió:
I have implemented the code according to Joe's suggestion, and
put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can you
please help me on submit the patch?Hi Liming,
I might be able to help, but it will be at least a couple of days
before I have the time to look at this,Joe
ok, thanks, I will wait.
Hi Joe,
Do you have some time in the weekend to help me submit the patch?
Thanks,
Liming
Liming
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/iQIcBAEBAgAGBQJRt50oAAoJEDfy90M199hliukP/A8IZf7L0DcYWG/jZUttTg0M
yWpCz1KHZ7fAGqeJ5ddzuSx5CMjsmt2zYQ+0EfLX1ftoSxIHaFpSC49GgJHUdAoq
TSOOC1rfkfmNJG98WfUPH14Flq4eEl9reUZDXXi3jqol+npJdAQaEt9EM5y0qkcB
pDCy9iMaYdjYNV6RXFOBNI+7Up43oULbMLhWwwFnGX9AgCLk8SGRZHnfT1zOaXYE
bW/Dl9TIu058ENZqFFLIfjxqngE/Y61SOaLRAxEkbO7HAFkuwgQwnIayrasR29F+
GX4+HRcsd0jrcF858Dm4E+YAffI2quOR2HgZTGQj6jTNtRpb16+EI+X1vrYI3AH8
5tf3exq9FDL/02zlCpKm8+uXksaLzffQXlbQPw8uDlpk+ThD0uo2990/TC6QYgXO
o2vCu+nkWdTc2AUk4NkoVFwXaaFLZ+M8U+swRHNAShqH7VQVx8rRwubsRJ1msT3i
nC8BFyMsBzOmsKNwO0IM6ZcsJXaIpmMCUshF8cGDfgpsWUQ/wzovzopb+PSiEKQB
X45hWYtiK3tIvo0f9gvEWzRJ4+O8tmmIZzzWz127yBdugV0xjsEHnDihpjkeMPJx
WHs5ViN62u62r34UCtX1oiClCC+FYR0f//alh48VlXWzP7NkFt4dcKOD6ZCzSOeQ
udKM0QF2TNbUebj9QIpq
=W6Oy
-----END PGP SIGNATURE-------
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Jun 14, 2013 at 10:08:24AM -0700, Liming Hu wrote:
On Tue, Jun 11, 2013 at 3:19 PM, Liming Hu <dawninghu@gmail.com> wrote:
On Tue, Jun 11, 2013 at 2:56 PM, Joe Conway <mail@joeconway.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 06/11/2013 02:23 PM, Liming Hu wrote:
On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:Liming Hu escribi�:
I have implemented the code according to Joe's suggestion, and
put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can you
please help me on submit the patch?Hi Liming,
I might be able to help, but it will be at least a couple of days
before I have the time to look at this,Joe
ok, thanks, I will wait.
Hi Joe,
Do you have some time in the weekend to help me submit the patch?
Thanks,Liming
Liming,
Is your git skill good enough to create a patch vs. PostgreSQL's git
master? If so, send that and once it's hit the mailing list, record
same on commitfest.postgresql.org in the current open commitfest. If
not, let us know where in that process you got stuck.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 06/14/2013 10:11 AM, David Fetter wrote:
ok, thanks, I will wait.
Hi Joe,
Do you have some time in the weekend to help me submit the patch?
Thanks,Liming
Liming,
Is your git skill good enough to create a patch vs. PostgreSQL's git
master? If so, send that and once it's hit the mailing list, record
same on commitfest.postgresql.org in the current open commitfest. If
not, let us know where in that process you got stuck.Cheers,
David.
This sounds like a wiki page FAQ in the making.
JD
--
Command Prompt, Inc. - http://www.commandprompt.com/ 509-416-6579
PostgreSQL Support, Training, Professional Services and Development
High Availability, Oracle Conversion, Postgres-XC, @cmdpromptinc
For my dreams of your image that blossoms
a rose in the deeps of my heart. - W.B. Yeats
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Jun 14, 2013 at 10:14:14AM -0700, Joshua D. Drake wrote:
On 06/14/2013 10:11 AM, David Fetter wrote:
ok, thanks, I will wait.
Hi Joe,
Do you have some time in the weekend to help me submit the patch?
Thanks,Liming
Liming,
Is your git skill good enough to create a patch vs. PostgreSQL's git
master? If so, send that and once it's hit the mailing list, record
same on commitfest.postgresql.org in the current open commitfest. If
not, let us know where in that process you got stuck.This sounds like a wiki page FAQ in the making.
With utmost respect, this sounds like several pages should be
consolidated into one and clarified. Yet another page will just make
matters more confusing.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Liming,
I'm putting this in the commitfest regardless, so that it at least gets
a review.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: WMe7c8aafaabf149184ab7f169e74e0140c6d3176d96871015737ae51c648bbbf6ed95b1b7613d428fa8aa09f0e2134ecb@asav-2.01.com
Liming,
I've added your proposal in to the commitfest so that you can get a
review this commitfest. However, you need to generate a context diff
and submit it to this mailing list for it to really get reviewed.
That's a requirement.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: WM72ece7d651136648b086d76c4fe7fa92328f3c433cc211aabca4739295d87d76ee12cbf8888c8c467e3da3cfaa885c4a@asav-1.01.com
On 6/15/2013 9:51 PM, Josh Berkus wrote:
Liming,
I've added your proposal in to the commitfest so that you can get a
review this commitfest. However, you need to generate a context diff
and submit it to this mailing list for it to really get reviewed.
That's a requirement.
Hi Josh,
Thanks. Where can I see the "proposal"? Thanks.
Liming
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 06/14/2013 10:17 AM, David Fetter wrote:
This sounds like a wiki page FAQ in the making.
With utmost respect, this sounds like several pages should be
consolidated into one and clarified. Yet another page will just make
matters more confusing.
Probably. I just tried to objectively review what it would take to
submit a patch. It is a little spaghetti. From the website I click
developers->coding. That seems straight forward enough. The developers
FAQ is the 7th link down after flooding me with information on the
source code. So the first suggestion would be to push the FAQ to the
very first link. That is a relatively simple fix.
However, then it gets messy. Basically, I think we are too thorough. If
I want to submit a simple patch to fix error strings, I certainly don't
need everything that is presented in our developers faq. I need:
1. Where do I get a git checkout (forget this download the source from
ftp, that I think is inviting problems.)
2. Exactly what do I need to do to submit a patch.
That is all. In order to get that information I have to wade through a
whole lot more information that isn't immediately useful or interesting.
So something like, submitting a patch in 10 steps.
Sincerely,
JD
Cheers,
David.
--
Sent via pgsql-www mailing list (pgsql-www@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-www
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/14/2013 12:08 PM, Liming Hu wrote:
I have implemented the code according to Joe's
suggestion, and put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1
Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can
you please help me on submit the patch?
I have not done much in the way of real review yet, but here at least
is a context diff against git master.
Joe
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iQIcBAEBAgAGBQJRyOw2AAoJEDfy90M199hlFhEP/2o/d08Fq4CHA9iI05PxDwQM
AHF6PWS5gJToNLtiTevyEamWyzlULjX3yJ9gTAhxc+ltxE9Xuf3/bfMcJQSbJ5c9
6GSH7CWpaY1DpfAwvYiwTJ9EPBZ11u8VZaMrb1VU2DS8rioOOL3llzpk+D6/1no5
y327vlH1aOuqk3Hwu0c/WN8RAcf1HLbhafph2KruUfr/ba3uILBQZtzpyK4uCDew
OJA+cktXHv3ho7w4N//xVQs3sZ/EoLahOt/y4syd3dN+Cq/8kj/uJaVgT2QY8rDQ
HIBpYvm+b3DsYpjw2qrSVBriIupF2a0UPkLfC5cu3om8VvBilShydE6uTI+f+55p
a12NuzepwgDnpZ1jOZkkmnBslpfoZI9TEo1UDeZ8x/TSZDW72FhwRtWq9kO9CFIK
cJvG9B9E5zhyZx9V1C2S0qpvIJAj/Gns4ymvYU1lm5UUnpPSpTQoUK8ybrfnHoTE
B0DEVjqxbrk9SSJ5LI3KojAaSMUIQDcjMQFCsghR1s5/yRhpZ7xEPvcL63ARwDcv
ZeeL6r5G+nmKAfRAjGbmWi/Y1ANI0ucO5XxnfhSDb+TCQow4U6IgNvkYjN1hTNEI
//9mQHDHi5qsuGcRcgvFLLeR4eVSGewseYLOR9XELMYTam4IUClwPr6WHuMqE/aE
jvMZafqZ/1EhQ2SeqCo4
=wcGM
-----END PGP SIGNATURE-----
Attachments:
Levenshtein-Damerau.difftext/x-patch; name=Levenshtein-Damerau.diffDownload
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql fuzzystrmatch/fuzzystrmatch--1.0.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql 2012-02-25 20:24:23.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch--1.0.sql 2013-06-11 04:09:01.000000000 -0500
***************
*** 1,4 ****
! /* contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
--- 1,4 ----
! /* contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
***************
*** 19,24 ****
--- 19,44 ----
AS 'MODULE_PATHNAME','levenshtein_less_equal_with_costs'
LANGUAGE C IMMUTABLE STRICT;
+ CREATE FUNCTION dameraulevenshteinnocompatible (text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs_noncompatible'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein (text,text) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein (text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
CREATE FUNCTION metaphone (text,int) RETURNS text
AS 'MODULE_PATHNAME','metaphone'
LANGUAGE C IMMUTABLE STRICT;
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql fuzzystrmatch/fuzzystrmatch--1.1.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql 1969-12-31 18:00:00.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch--1.1.sql 2013-06-11 04:09:01.000000000 -0500
***************
*** 0 ****
--- 1,60 ----
+ /* contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql */
+
+ -- complain if script is sourced in psql, rather than via CREATE EXTENSION
+ \echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
+
+ CREATE FUNCTION levenshtein (text,text) RETURNS int
+ AS 'MODULE_PATHNAME','levenshtein'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION levenshtein (text,text,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','levenshtein_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION levenshtein_less_equal (text,text,int) RETURNS int
+ AS 'MODULE_PATHNAME','levenshtein_less_equal'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION levenshtein_less_equal (text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','levenshtein_less_equal_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein (text,text) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein (text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION metaphone (text,int) RETURNS text
+ AS 'MODULE_PATHNAME','metaphone'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION soundex(text) RETURNS text
+ AS 'MODULE_PATHNAME', 'soundex'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION text_soundex(text) RETURNS text
+ AS 'MODULE_PATHNAME', 'soundex'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION difference(text,text) RETURNS int
+ AS 'MODULE_PATHNAME', 'difference'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dmetaphone (text) RETURNS text
+ AS 'MODULE_PATHNAME', 'dmetaphone'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dmetaphone_alt (text) RETURNS text
+ AS 'MODULE_PATHNAME', 'dmetaphone_alt'
+ LANGUAGE C IMMUTABLE STRICT;
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch.c fuzzystrmatch/fuzzystrmatch.c
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch.c 2013-02-03 11:09:42.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch.c 2013-06-11 04:09:01.000000000 -0500
***************
*** 53,58 ****
--- 53,64 ----
extern Datum levenshtein(PG_FUNCTION_ARGS);
extern Datum levenshtein_less_equal_with_costs(PG_FUNCTION_ARGS);
extern Datum levenshtein_less_equal(PG_FUNCTION_ARGS);
+
+ extern Datum dameraulevenshtein_with_costs(PG_FUNCTION_ARGS);
+ extern Datum dameraulevenshtein(PG_FUNCTION_ARGS);
+ extern Datum dameraulevenshtein_less_equal_with_costs(PG_FUNCTION_ARGS);
+ extern Datum dameraulevenshtein_less_equal(PG_FUNCTION_ARGS);
+
extern Datum metaphone(PG_FUNCTION_ARGS);
extern Datum soundex(PG_FUNCTION_ARGS);
extern Datum difference(PG_FUNCTION_ARGS);
***************
*** 193,199 ****
int del_c = PG_GETARG_INT32(3);
int sub_c = PG_GETARG_INT32(4);
! PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c));
}
--- 199,205 ----
int del_c = PG_GETARG_INT32(3);
int sub_c = PG_GETARG_INT32(4);
! PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c, 0));
}
***************
*** 204,210 ****
text *src = PG_GETARG_TEXT_PP(0);
text *dst = PG_GETARG_TEXT_PP(1);
! PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1));
}
--- 210,216 ----
text *src = PG_GETARG_TEXT_PP(0);
text *dst = PG_GETARG_TEXT_PP(1);
! PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1, 0));
}
***************
*** 219,225 ****
int sub_c = PG_GETARG_INT32(4);
int max_d = PG_GETARG_INT32(5);
! PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, ins_c, del_c, sub_c, max_d));
}
--- 225,231 ----
int sub_c = PG_GETARG_INT32(4);
int max_d = PG_GETARG_INT32(5);
! PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, ins_c, del_c, sub_c, 0, max_d));
}
***************
*** 231,240 ****
text *dst = PG_GETARG_TEXT_PP(1);
int max_d = PG_GETARG_INT32(2);
! PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, 1, 1, 1, max_d));
}
/*
* Calculates the metaphone of an input string.
* Returns number of characters requested
--- 237,298 ----
text *dst = PG_GETARG_TEXT_PP(1);
int max_d = PG_GETARG_INT32(2);
! PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, 1, 1, 1, 0, max_d));
! }
!
! PG_FUNCTION_INFO_V1(dameraulevenshtein_with_costs);
! Datum
! dameraulevenshtein_with_costs(PG_FUNCTION_ARGS)
! {
! text *src = PG_GETARG_TEXT_PP(0);
! text *dst = PG_GETARG_TEXT_PP(1);
! int ins_c = PG_GETARG_INT32(2);
! int del_c = PG_GETARG_INT32(3);
! int sub_c = PG_GETARG_INT32(4);
! int trans_c = PG_GETARG_INT32(5);
!
! PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c, trans_c));
! }
!
!
! PG_FUNCTION_INFO_V1(dameraulevenshtein);
! Datum
! dameraulevenshtein(PG_FUNCTION_ARGS)
! {
! text *src = PG_GETARG_TEXT_PP(0);
! text *dst = PG_GETARG_TEXT_PP(1);
!
! PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1, 1));
}
+ PG_FUNCTION_INFO_V1(dameraulevenshtein_less_equal_with_costs);
+ Datum
+ dameraulevenshtein_less_equal_with_costs(PG_FUNCTION_ARGS)
+ {
+ text *src = PG_GETARG_TEXT_PP(0);
+ text *dst = PG_GETARG_TEXT_PP(1);
+ int ins_c = PG_GETARG_INT32(2);
+ int del_c = PG_GETARG_INT32(3);
+ int sub_c = PG_GETARG_INT32(4);
+ int trans_c = PG_GETARG_INT32(5);
+ int max_d = PG_GETARG_INT32(6);
+
+ PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, ins_c, del_c, sub_c, trans_c, max_d));
+ }
+
+
+ PG_FUNCTION_INFO_V1(dameraulevenshtein_less_equal);
+ Datum
+ dameraulevenshtein_less_equal(PG_FUNCTION_ARGS)
+ {
+ text *src = PG_GETARG_TEXT_PP(0);
+ text *dst = PG_GETARG_TEXT_PP(1);
+ int max_d = PG_GETARG_INT32(2);
+
+ PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, 1, 1, 1, 1, max_d));
+ }
+
/*
* Calculates the metaphone of an input string.
* Returns number of characters requested
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch.control fuzzystrmatch/fuzzystrmatch.control
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch.control 2011-02-17 11:19:41.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch.control 2013-06-11 04:09:01.000000000 -0500
***************
*** 1,5 ****
# fuzzystrmatch extension
comment = 'determine similarities and distance between strings'
! default_version = '1.0'
module_pathname = '$libdir/fuzzystrmatch'
relocatable = true
--- 1,5 ----
# fuzzystrmatch extension
comment = 'determine similarities and distance between strings'
! default_version = '1.1'
module_pathname = '$libdir/fuzzystrmatch'
relocatable = true
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql 2012-02-25 20:24:23.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql 2013-06-11 04:09:01.000000000 -0500
***************
*** 1,10 ****
! /* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
ALTER EXTENSION fuzzystrmatch ADD function soundex(text);
ALTER EXTENSION fuzzystrmatch ADD function text_soundex(text);
--- 1,14 ----
! /* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
+
+ ALTER EXTENSION fuzzystrmatch ADD function dameraulevenshteinnoncompatible(text,text,integer,integer,integer,integer);
+ ALTER EXTENSION fuzzystrmatch ADD function dameraulevenshtein(text,text);
+ ALTER EXTENSION fuzzystrmatch ADD function dameraulevenshtein(text,text,integer,integer,integer,integer);
ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
ALTER EXTENSION fuzzystrmatch ADD function soundex(text);
ALTER EXTENSION fuzzystrmatch ADD function text_soundex(text);
***************
*** 21,23 ****
--- 25,39 ----
CREATE FUNCTION levenshtein_less_equal (text,text,int,int,int,int) RETURNS int
AS 'MODULE_PATHNAME','levenshtein_less_equal_with_costs'
LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal_noncompatible (text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs_noncompatible'
+ LANGUAGE C IMMUTABLE STRICT;
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql 1969-12-31 18:00:00.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql 2013-06-11 04:09:01.000000000 -0500
***************
*** 0 ****
--- 1,33 ----
+ /* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql */
+
+ -- complain if script is sourced in psql, rather than via CREATE EXTENSION
+ \echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
+
+ ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
+ ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
+ ALTER EXTENSION fuzzystrmatch ADD function levenshtein_less_equal (text,text,int);
+ ALTER EXTENSION fuzzystrmatch ADD function levenshtein_less_equal (text,text,int,int,int,int);
+ ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
+ ALTER EXTENSION fuzzystrmatch ADD function soundex(text);
+ ALTER EXTENSION fuzzystrmatch ADD function text_soundex(text);
+ ALTER EXTENSION fuzzystrmatch ADD function difference(text,text);
+ ALTER EXTENSION fuzzystrmatch ADD function dmetaphone(text);
+ ALTER EXTENSION fuzzystrmatch ADD function dmetaphone_alt(text);
+
+ -- these functions were not in 9.3
+
+ CREATE FUNCTION dameraulevenshtein (text,text) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein (text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+ LANGUAGE C IMMUTABLE STRICT;
+
+ CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+ LANGUAGE C IMMUTABLE STRICT;
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/levenshtein.c fuzzystrmatch/levenshtein.c
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/levenshtein.c 2013-02-03 11:09:42.000000000 -0600
--- fuzzystrmatch/levenshtein.c 2013-06-11 04:09:01.000000000 -0500
***************
*** 16,21 ****
--- 16,27 ----
* inspiration.
* Configurable penalty costs extension is introduced by Volkan
* YAZICI <volkan.yazici@gmail.com>.
+ * Damerau levenshtein variant
+ * Liming Hu <dawninghu@gmail.com>
+ * based on description of the algorithm:
+ * http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
+ * and:
+ * http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/tools/perf/util/levenshtein.c
*/
/*
***************
*** 23,41 ****
*/
#ifdef LEVENSHTEIN_LESS_EQUAL
static int levenshtein_less_equal_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int max_d);
#else
static int levenshtein_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c);
#endif
#define MAX_LEVENSHTEIN_STRLEN 255
/*
! * Calculates Levenshtein distance metric between supplied strings. Generally
! * (1, 1, 1) penalty costs suffices for common cases, but your mileage may
! * vary.
*
* One way to compute Levenshtein distance is to incrementally construct
* an (m+1)x(n+1) matrix where cell (i, j) represents the minimum number
--- 29,52 ----
*/
#ifdef LEVENSHTEIN_LESS_EQUAL
static int levenshtein_less_equal_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int trans_c, int max_d);
! static int dameraulevenshtein_less_equal_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int trans_c, int max_d);
!
#else
static int levenshtein_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int trans_c);
! static int dameraulevenshtein_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int trans_c);
#endif
#define MAX_LEVENSHTEIN_STRLEN 255
/*
! * Calculates [Damerau ]Levenshtein distance metric between supplied strings. Generally
! * (1, 1, 1 [, 1]) penalty costs suffices for common cases, but your mileage
! * may vary.
*
* One way to compute Levenshtein distance is to incrementally construct
* an (m+1)x(n+1) matrix where cell (i, j) represents the minimum number
***************
*** 43,53 ****
* the first j characters of t. The last column of the final row is the
* answer.
*
! * We use that algorithm here with some modification. In lieu of holding
! * the entire array in memory at once, we'll just use two arrays of size
! * m+1 for storing accumulated values. At each step one array represents
! * the "previous" row and one is the "current" row of the notional large
! * array.
*
* If max_d >= 0, we only need to provide an accurate answer when that answer
* is less than or equal to the bound. From any cell in the matrix, there is
--- 54,75 ----
* the first j characters of t. The last column of the final row is the
* answer.
*
! * We use that algorithm here with some modification. In the case of Levenshtein
! * distance: in lieu of holding the entire array in memory at once, we'll just use
! * two arrays of size m+1 for storing accumulated values. At each step one array
! * represents the "previous" row and one is the "current" row of the notional large
! * array. In the case of Damerau-Levenshtein distance, to avoid a large space complexity,
! * only the last three rows are kept in memory (if swaps had the same or higher cost
! * as one deletion plus one insertion, only two rows would be needed).
! * At any stage, "i + 1" denotes the length of the current substring of
! * s_data that the distance is calculated for.
! *
! * row2 holds the current row, row1 the previous row (i.e. for the substring
! * of s_data of length "i"), and row0 the row before that.
! *
! * In other words, at the start of the big loop, row2[j + 1] contains the
! * Damerau-Levenshtein distance between the substring of s_data of length
! * "i" and the substring of t_data of length "j + 1".
*
* If max_d >= 0, we only need to provide an accurate answer when that answer
* is less than or equal to the bound. From any cell in the matrix, there is
***************
*** 66,77 ****
static int
#ifdef LEVENSHTEIN_LESS_EQUAL
levenshtein_less_equal_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int max_d)
#else
levenshtein_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c)
#endif
{
int m,
n,
s_bytes,
--- 88,112 ----
static int
#ifdef LEVENSHTEIN_LESS_EQUAL
levenshtein_less_equal_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int trans_c, int max_d)
#else
levenshtein_internal(text *s, text *t,
! int ins_c, int del_c, int sub_c, int trans_c)
#endif
{
+
+
+
+ #ifdef LEVENSHTEIN_LESS_EQUAL
+ if (trans_c!=0)
+ return dameraulevenshtein_less_equal_internal(s,t, ins_c, del_c, sub_c, trans_c, max_d);
+ #else
+ if (trans_c!=0)
+ return dameraulevenshtein_internal(s,t, ins_c, del_c, sub_c, trans_c);
+ #endif
+
+
+
int m,
n,
s_bytes,
***************
*** 275,280 ****
--- 310,316 ----
int ins;
int del;
int sub;
+ int trans;
int x_char_len = s_char_len[i - 1];
/*
***************
*** 310,315 ****
--- 346,352 ----
int ins;
int del;
int sub;
+ int trans;
/* Calculate costs for insertion, deletion, and substitution. */
ins = prev[i] + ins_c;
***************
*** 401,403 ****
--- 438,504 ----
*/
return prev[m - 1];
}
+
+ static int
+ #ifdef LEVENSHTEIN_LESS_EQUAL
+ dameraulevenshtein_less_equal_internal(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c, int max_d)
+ #else
+ dameraulevenshtein_internal(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c)
+ #endif
+ {
+
+ /* Extract a pointer to the actual character data. */
+ const char *s_data = VARDATA_ANY(s);
+ const char *t_data = VARDATA_ANY(t);
+
+ /* Determine length of each string in bytes and characters. */
+ int s_bytes = VARSIZE_ANY_EXHDR(s);
+ int t_bytes = VARSIZE_ANY_EXHDR(t);
+ /* returns the length (counted in wchars) of a multibyte string
+ * (not necessarily NULL terminated)
+ */
+ int length1 = pg_mbstrlen_with_len(s_data, s_bytes);
+ int length2 = pg_mbstrlen_with_len(t_data, t_bytes);
+
+ int *row0 = (int*) palloc(sizeof(int) * (length2 + 1)); /*the row before that.*/
+ int *row1 = (int*) palloc(sizeof(int) * (length2 + 1)); /*the previous row, for the substring of s_data of length i*/
+ int *row2 = (int*) palloc(sizeof(int) * (length2 + 1)); /*current row.*/
+ int i, j;
+ int distance = 0;
+
+ for (j = 0; j <= length2; j++) /*length2+1*/
+ row1[j] = j * ins_c;
+
+ for (i = 0; i < length1; i++) { /*length1: determines the partial minimum-cost paths.*/
+ int *dummy;
+
+ row2[0] = (i + 1) * del_c;
+ for (j = 0; j < length2; j++) { /*length2*/
+
+ row2[j + 1] = row1[j] + sub_c * (s_data[i] != t_data[j]); /* substitution */
+
+ if (i > 0 && j > 0 && s_data[i - 1] == t_data[j] &&
+ s_data[i] == t_data[j - 1] && /* transposition */
+ row2[j + 1] > row0[j - 1] + trans_c)
+ row2[j + 1] = row0[j - 1] + trans_c;
+
+ if (row2[j + 1] > row1[j + 1] + del_c) /* deletion */
+ row2[j + 1] = row1[j + 1] + del_c;
+
+ if (row2[j + 1] > row2[j] + ins_c) /* insertion */
+ row2[j + 1] = row2[j] + ins_c;
+ }
+
+ dummy = row0;
+ row0 = row1;
+ row1 = row2;
+ row2 = dummy;
+ }
+
+ distance = row1[length2];
+ return distance;
+ }
+
+
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/Makefile fuzzystrmatch/Makefile
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/Makefile 2011-05-06 01:09:32.000000000 -0500
--- fuzzystrmatch/Makefile 2013-06-11 04:09:01.000000000 -0500
***************
*** 4,10 ****
OBJS = fuzzystrmatch.o dmetaphone.o
EXTENSION = fuzzystrmatch
! DATA = fuzzystrmatch--1.0.sql fuzzystrmatch--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
--- 4,10 ----
OBJS = fuzzystrmatch.o dmetaphone.o
EXTENSION = fuzzystrmatch
! DATA = fuzzystrmatch--1.1.sql fuzzystrmatch--unpackaged--1.1.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/README.md fuzzystrmatch/README.md
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/README.md 1969-12-31 18:00:00.000000000 -0600
--- fuzzystrmatch/README.md 2013-06-11 04:09:01.000000000 -0500
***************
*** 0 ****
--- 1,4 ----
+ fuzzystrmatch
+ =============
+
+ add Damerau-Levenshtein algorithm to fuzzystrmatch in PostgreSql
On Mon, Jun 24, 2013 at 6:02 PM, Joe Conway <mail@joeconway.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 06/14/2013 12:08 PM, Liming Hu wrote:
I have implemented the code according to Joe's
suggestion, and put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1Please submit a proper patch so it can be seen on our mailing list
archives.
Hi Alvaro,
I am kind of new to the Postgresql hacker community, Can
you please help me on submit the patch?I have not done much in the way of real review yet, but here at least
is a context diff against git master.Joe
Hi Joe,
Thanks a lot.
please remove "dameraulevenshteinnocompatible" related stuff, I just
followed the template you created.
"dameraulevenshteinnocompatible" was used in my first testing.
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
fuzzystrmatch/fuzzystrmatch--1.0.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
2012-02-25 20:24:23.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch--1.0.sql 2013-06-11 04:09:01.000000000 -0500
CREATE FUNCTION dameraulevenshteinnocompatible
(text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs_noncompatible'
+ LANGUAGE C IMMUTABLE STRICT;
please remove "dameraulevenshteinnocompatible" related stuff, I just
followed the template you created.
"dameraulevenshteinnocompatible" was used in my first testing.
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
2012-02-25 20:24:23.000000000 -0600
--- fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql 2013-06-11
04:09:01.000000000 -0500
+ ALTER EXTENSION fuzzystrmatch ADD function
dameraulevenshteinnoncompatible(text,text,integer,integer,integer,integer);
+CREATE FUNCTION dameraulevenshtein_less_equal_noncompatible
(text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs_noncompatible'
+ LANGUAGE C IMMUTABLE STRICT;
I updated:
https://github.com/liminghu/fuzzystrmatch/blob/fuzzystrmatchv1.1/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/fuzzystrmatchv1.1/fuzzystrmatch--unpackaged--1.0.sql
correspondingly.
Sorry about that.
Thanks and nice day.
Liming
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/iQIcBAEBAgAGBQJRyOw2AAoJEDfy90M199hlFhEP/2o/d08Fq4CHA9iI05PxDwQM
AHF6PWS5gJToNLtiTevyEamWyzlULjX3yJ9gTAhxc+ltxE9Xuf3/bfMcJQSbJ5c9
6GSH7CWpaY1DpfAwvYiwTJ9EPBZ11u8VZaMrb1VU2DS8rioOOL3llzpk+D6/1no5
y327vlH1aOuqk3Hwu0c/WN8RAcf1HLbhafph2KruUfr/ba3uILBQZtzpyK4uCDew
OJA+cktXHv3ho7w4N//xVQs3sZ/EoLahOt/y4syd3dN+Cq/8kj/uJaVgT2QY8rDQ
HIBpYvm+b3DsYpjw2qrSVBriIupF2a0UPkLfC5cu3om8VvBilShydE6uTI+f+55p
a12NuzepwgDnpZ1jOZkkmnBslpfoZI9TEo1UDeZ8x/TSZDW72FhwRtWq9kO9CFIK
cJvG9B9E5zhyZx9V1C2S0qpvIJAj/Gns4ymvYU1lm5UUnpPSpTQoUK8ybrfnHoTE
B0DEVjqxbrk9SSJ5LI3KojAaSMUIQDcjMQFCsghR1s5/yRhpZ7xEPvcL63ARwDcv
ZeeL6r5G+nmKAfRAjGbmWi/Y1ANI0ucO5XxnfhSDb+TCQow4U6IgNvkYjN1hTNEI
//9mQHDHi5qsuGcRcgvFLLeR4eVSGewseYLOR9XELMYTam4IUClwPr6WHuMqE/aE
jvMZafqZ/1EhQ2SeqCo4
=wcGM
-----END PGP SIGNATURE-----
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/25/2013 01:37 PM, Liming Hu wrote:
please remove "dameraulevenshteinnocompatible" related stuff, I
just followed the template you created.
"dameraulevenshteinnocompatible" was used in my first testing.
diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
diff -cNr
/opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
Actually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?
Joe
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iQIcBAEBAgAGBQJRz0V5AAoJEDfy90M199hl3sgP/Ai51I56A7luUhRFt2s3eo0p
HWiuxsWU2tXwoGmvYFtSze80mpfBfCGpBrD+uhh2PLZlFt6uS21wpYaezr1Y9wAM
astvWAOXVOg/AUlb5lyoAze5CL3kpRVX7EvUPGrzb6RMK3VfIckRdIoqwh8/Ko/C
j1ECEcWMHsRDUUDs+kU/mXAyRKpnC+VdSwOAU/k3J7Q0KpSvCZ4R+codinR29Ub4
L4W30436IKOr+BktorFc24FYRpVVG2llMPtWUhgKb1MfW5d+NRqID0gTIF4a9TJr
yaEBmmT1eupdje4pwY3R+xDGroCj3AAx7PAfW+CRMrsYvEFVy945l2lbSjvqDlDy
lpFsWWepYNdQhZBKP0Au986aqTKmoKgFoyWV/Yi7BfLx7Gh70Wk8OPcDKuUIdHou
UNfMouAUxGW9ZHZRmDSaYncTnLEcEJS11akddoIKDXCbdTVAQXFGLNqv1pp0KN+J
xU1eOrh+oQVwTayZH+S2Xa8+AT+g9wLH5zynJozDSRitdLIGdN1zzUVVXdO1Nx2i
2anxXdoW4DB+x+G8ea2Wmxfsw3MMS8Ck10VqhN6JMojDP0rczA6+EFrZcBlsWlWx
LX4iPTroUGZ318IC+A2CXci0uXs7+2l2zrescpEdqrqcTwTJHpGFbRbYniGBFgXW
6LeSPHhRDQUykXMvEU9I
=xeVQ
-----END PGP SIGNATURE-----
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 6/29/2013 1:37 PM, Joe Conway wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 06/25/2013 01:37 PM, Liming Hu wrote:
please remove "dameraulevenshteinnocompatible" related stuff, I
just followed the template you created.
"dameraulevenshteinnocompatible" was used in my first testing.
diff -cNr
/opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sqldiff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sqlActually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?Joe
Thanks. It is my first contribution to Postgresql community.
LIming
- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/iQIcBAEBAgAGBQJRz0V5AAoJEDfy90M199hl3sgP/Ai51I56A7luUhRFt2s3eo0p
HWiuxsWU2tXwoGmvYFtSze80mpfBfCGpBrD+uhh2PLZlFt6uS21wpYaezr1Y9wAM
astvWAOXVOg/AUlb5lyoAze5CL3kpRVX7EvUPGrzb6RMK3VfIckRdIoqwh8/Ko/C
j1ECEcWMHsRDUUDs+kU/mXAyRKpnC+VdSwOAU/k3J7Q0KpSvCZ4R+codinR29Ub4
L4W30436IKOr+BktorFc24FYRpVVG2llMPtWUhgKb1MfW5d+NRqID0gTIF4a9TJr
yaEBmmT1eupdje4pwY3R+xDGroCj3AAx7PAfW+CRMrsYvEFVy945l2lbSjvqDlDy
lpFsWWepYNdQhZBKP0Au986aqTKmoKgFoyWV/Yi7BfLx7Gh70Wk8OPcDKuUIdHou
UNfMouAUxGW9ZHZRmDSaYncTnLEcEJS11akddoIKDXCbdTVAQXFGLNqv1pp0KN+J
xU1eOrh+oQVwTayZH+S2Xa8+AT+g9wLH5zynJozDSRitdLIGdN1zzUVVXdO1Nx2i
2anxXdoW4DB+x+G8ea2Wmxfsw3MMS8Ck10VqhN6JMojDP0rczA6+EFrZcBlsWlWx
LX4iPTroUGZ318IC+A2CXci0uXs7+2l2zrescpEdqrqcTwTJHpGFbRbYniGBFgXW
6LeSPHhRDQUykXMvEU9I
=xeVQ
-----END PGP SIGNATURE-----
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sun, Jun 30, 2013 at 5:37 AM, Joe Conway <mail@joeconway.com> wrote:
Actually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?
When upgrading this extension here is what you should do:
- Remove fuzzystrmatch--1.0.sql
- Add fuzzystrmatch--1.1.sql with the new definitions
- Add fuzzystrmatch--1.0--1.1.sql to be able to perform an upgrade
between 1.0 and 1.1
- Let fuzzystrmatch--unpackaged--1.0.sql as-is
Then by having a quick glance at the patch you sent...
- fuzzystrmatch--unpackaged--1.0.sql is renamed internally to 1.1.sql
- fuzzystrmatch--1.0.sql remains, and is renamed to 1.1 internally
- fuzzystrmatch--1.0--1.1.sql is not provided
Regards,
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Joe Conway escribi�:
Actually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?
Besides what Michael said, another thing is that you need to ensure that
if the functions are run with the 1.0 definitions, they don't crash
(i.e. you need to check the number of arguments actually passed to
function(s), and ensure no changes are made to the types of previously
existing arguments). You can test this by installing the 1.0 version in
a 9.3 database, then pg_upgrade, and test the functions without running
the ALTER EXTENSION UPGRADE.
--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 06/29/2013 01:37 PM, Joe Conway wrote:
On 06/25/2013 01:37 PM, Liming Hu wrote:
please remove "dameraulevenshteinnocompatible" related stuff, I
just followed the template you created.
"dameraulevenshteinnocompatible" was used in my first testing.diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sqldiff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sqlActually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?
I believe that's correct.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: WMe342bfe37d87a32b046d4263ff15e4088fd901297beb9fbcbea7a1ed208d41ff622a27b9331e96485bb1cfd6350cce31@asav-2.01.com
On Sat, Jun 29, 2013 at 7:55 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Sun, Jun 30, 2013 at 5:37 AM, Joe Conway <mail@joeconway.com> wrote:
Actually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?When upgrading this extension here is what you should do:
- Remove fuzzystrmatch--1.0.sql
- Add fuzzystrmatch--1.1.sql with the new definitions
- Add fuzzystrmatch--1.0--1.1.sql to be able to perform an upgrade
between 1.0 and 1.1
- Let fuzzystrmatch--unpackaged--1.0.sql as-is
Hi Michael,
Thanks. What should be included in fuzzystrmatch--1.0--1.1.sql for the upgrade?
Liming
Then by having a quick glance at the patch you sent...
- fuzzystrmatch--unpackaged--1.0.sql is renamed internally to 1.1.sql
- fuzzystrmatch--1.0.sql remains, and is renamed to 1.1 internally
- fuzzystrmatch--1.0--1.1.sql is not providedRegards,
--
Michael
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Mon, Jul 1, 2013 at 8:09 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
Joe Conway escribió:
Actually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?Besides what Michael said, another thing is that you need to ensure that
if the functions are run with the 1.0 definitions, they don't crash
(i.e. you need to check the number of arguments actually passed to
function(s), and ensure no changes are made to the types of previously
existing arguments). You can test this by installing the 1.0 version in
a 9.3 database, then pg_upgrade, and test the functions without running
the ALTER EXTENSION UPGRADE.--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Hi Alvaro,
I do not have a 9.3 environment. I did not change any previous existing code.
Can anybody help me on the upgrade?
Thanks,
Liming
--
Liming Hu
cell: (435)-512-4190
Seattle Washington
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Liming Hu escribi�:
I do not have a 9.3 environment. I did not change any previous existing code.
git checkout REL9_3_STABLE
--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Liming,
Given that this patch will not be ready for commit this week, but has
gotten a review, I am marking it as "Returned with Feedback". Please
keep working on it, and as soon as you have a new version of the patch,
add it to the September commitfest. Thanks!
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: WM13b4aea1326914855e944217f0c5395f8cfc86e7a01df5a0b1d02522bd9fdd3288d20622ee2fb667ab8e15339ac87e8f@asav-3.01.com
Josh Berkus escribi�:
Liming,
Given that this patch will not be ready for commit this week, but has
gotten a review, I am marking it as "Returned with Feedback". Please
keep working on it, and as soon as you have a new version of the patch,
add it to the September commitfest. Thanks!
I don't think this patch has gotten any useful review actually.
--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 07/03/2013 04:05 PM, Alvaro Herrera wrote:
Josh Berkus escribió:
Liming,
Given that this patch will not be ready for commit this week, but has
gotten a review, I am marking it as "Returned with Feedback". Please
keep working on it, and as soon as you have a new version of the patch,
add it to the September commitfest. Thanks!I don't think this patch has gotten any useful review actually.
Oh? I thought it was at the state where Liming had to do a whole bunch
of changes before it could be reviewed further?
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Import Notes
Reply to msg id not found: WM54e96906004bd2cd65680e488d11146bd2881730331c3a4c3accd70c0238a10537554e60a142b8cd33e06d9ef4e26aad@asav-3.01.com
On Thu, Jul 4, 2013 at 8:05 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
Josh Berkus escribió:
Liming,
Given that this patch will not be ready for commit this week, but has
gotten a review, I am marking it as "Returned with Feedback". Please
keep working on it, and as soon as you have a new version of the patch,
add it to the September commitfest. Thanks!I don't think this patch has gotten any useful review actually.
Exactly. I didn't check the content of the patch, just looked quickly
at the changes done for the extension upgrade.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Josh Berkus wrote:
On 07/03/2013 04:05 PM, Alvaro Herrera wrote:
Josh Berkus escribi�:
Liming,
Given that this patch will not be ready for commit this week, but has
gotten a review, I am marking it as "Returned with Feedback". Please
keep working on it, and as soon as you have a new version of the patch,
add it to the September commitfest. Thanks!I don't think this patch has gotten any useful review actually.
Oh? I thought it was at the state where Liming had to do a whole bunch
of changes before it could be reviewed further?
No, the comments have been solely on the details of the extension
definition files and the like. There has been not a single comment
about the new algorithm being proposed, which is the interesting stuff
in this patch. Review can certainly proceed without regard for the sql
files at all.
--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hi Liming,
Here is a more formal review of this patch.
First, when submitting a patch, please follow the following guidelines:
http://wiki.postgresql.org/wiki/Submitting_a_Patch
http://wiki.postgresql.org/wiki/Creating_Clean_Patches
Particularly, when you develop a new feature, people will expect that
you submit your patches based on the master branch in git. This
extremely facilitates the review and test work that can be done based
on your work. So do not create a new dedicated project on github like
that => https://github.com/liminghu/fuzzystrmatch, but for example
fork the postgres repository, and work directly on it using for
example custom branches, then generate patches between your custom
branches and postgres master branch.
Also, new features need to be submitted to a commit fest
(https://commitfest.postgresql.org/). The next commit fest is in
September, so you have plenty of time to update your patch based on
the comments of my review (and perhaps comments of others), then
register a patch directly there when you are done.
In order to perform my review, I took your github project and
generated a diff patch. The patch is attached, and applies to master
branch, so you could use it for your future work as a base.
OK, now for the review, here are some comments about the structure of
the patch, which is incorrect based on the structure extensions need
to have.
1) This patch lacks documentation, you shouldn't add a README.md file.
So remove it and updated the dedicated sgml documentation. In your
case, the file to be updated with more details about
Damerau–Levenshtein is doc/src/sgml/fuzzystrmatch.sgml.
2) Remove fuzzystrmatch--1.0.sql, this is not necessary anymore
because this module is upgraded to 1.1
3) Remove fuzzystrmatch--unpackaged--1.1.sql, it is not needed
4) Add fuzzystrmatch--1.0--1.1.sql, which is a file that can be used
to upgrade an existing fuzzystrmatch 1.0 to 1.1. This needs to contain
all the modifications allowing to do a correct upgrade: alter existing
objects to their new shape, add new objects, and remove unnecessary
objects. In your case, this file should have this shape:
/* contrib/fuzzystrmatch/fuzzystrmatch--1.0--1.1.sql */
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION fuzzystrmatch UPDATE" to load this file. \quit
CREATE FUNCTION damerau_levenstein()...
etc.
5) Your code copies a function from TOMOYO Linux, which is under GPL2
license, so I believe that this cannot be integrated to Postgres which
is under PostgreSQL license (more permissive). Just based on that some
portions of this code cannot be included in Postgres, I am not sure
but this gives a sufficient reason to reject this patch.
This is all I have about the shape of the patch...
Also, I am not (yet) very familiar with Damerau–Levenshtein itself and
I need to read more about that before giving a precise opinion... but
here are some comments anyway based on what I can read from the code:
1) There is a lot of duplicated code among levenshtein.c,
dameraulevenshtein.c and dameraulevenshtein_new.c, why is that?
levenshtein.c refers even to a variable called trans_c which is even
used nowehere.
2) By doing a simple diff between for example levenshtein.c and
dameraulevenshtein.c, the only new thing is the function called
dameraulevenshtein_internal_noncompatible copied from tomoyo linux...
And this function is used nowhere... The new functions for
Damerau–Levenshtein equivalent to levenshtein[_less_equal], called
damaraulevenshtein[_less_equal], are exactly the same things
So, in short, even if I may not be able to give a precise opinion
about Damerau–Levenshtein, what this patch tries to achieve is unclear
to me... The only new feature I can see is
dameraulevenshtein_internal_noncompatible but this is taken from code
licensed as GPL.
--
Michael
Attachments:
20130704_damerau_levenstein.patchapplication/octet-stream; name=20130704_damerau_levenstein.patchDownload
diff --git a/contrib/fuzzystrmatch/Makefile b/contrib/fuzzystrmatch/Makefile
index 834b679..1066a70 100644
--- a/contrib/fuzzystrmatch/Makefile
+++ b/contrib/fuzzystrmatch/Makefile
@@ -4,7 +4,7 @@ MODULE_big = fuzzystrmatch
OBJS = fuzzystrmatch.o dmetaphone.o
EXTENSION = fuzzystrmatch
-DATA = fuzzystrmatch--1.0.sql fuzzystrmatch--unpackaged--1.0.sql
+DATA = fuzzystrmatch--1.1.sql fuzzystrmatch--unpackaged--1.1.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/fuzzystrmatch/README.md b/contrib/fuzzystrmatch/README.md
new file mode 100644
index 0000000..0407dca
--- /dev/null
+++ b/contrib/fuzzystrmatch/README.md
@@ -0,0 +1,4 @@
+fuzzystrmatch
+=============
+
+add Damerau-Levenshtein algorithm to fuzzystrmatch in PostgreSql
diff --git a/contrib/fuzzystrmatch/dameraulevenshtein.c b/contrib/fuzzystrmatch/dameraulevenshtein.c
new file mode 100644
index 0000000..4a97def
--- /dev/null
+++ b/contrib/fuzzystrmatch/dameraulevenshtein.c
@@ -0,0 +1,538 @@
+/*
+ * dameraulevenshtein.c
+ *
+ * Functions for "fuzzy" comparison of strings
+ *
+ * Joe Conway <mail@joeconway.com>
+ *
+ * Copyright (c) 2001-2011, PostgreSQL Global Development Group
+ * ALL RIGHTS RESERVED;
+ *
+ * levenshtein()
+ * -------------
+ * Written based on a description of the algorithm by Michael Gilleland
+ * found at http://www.merriampark.com/ld.htm
+ * Also looked at levenshtein.c in the PHP 4.0.6 distribution for
+ * inspiration.
+ * Configurable penalty costs extension is introduced by Volkan
+ * YAZICI <volkan.yazici@gmail.com>.
+ *
+ * dameraulevenshtein()
+ * Liming Hu <dawninghu@gmail.com>
+ * description of the algorithm:
+ * http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
+ * and:
+ * http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/tools/perf/util/levenshtein.c
+ *
+ * -------------
+ * followed the same style and Written based on levenshtein.c
+ * (by Joe Conway <mail@joeconway.com> and volkan.yazici@gmail.com )
+ * in fuzzystrmatch contribution.
+ */
+
+/*
+ * External declarations for exported functions
+ */
+#ifdef DAMERAU_LEVENSHTEIN_LESS_EQUAL
+static int dameraulevenshtein_less_equal_internal(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c, int max_d);
+#else
+static int dameraulevenshtein_internal(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c);
+#endif
+
+#define MAX_DAMERAU_LEVENSHTEIN_STRLEN 255
+
+
+/*
+ * Calculates Damerau-Levenshtein distance metric between supplied strings. Generally
+ * (1, 1, 1, 1) penalty costs suffices for common cases, but your mileage may
+ * vary.
+ *
+ * One way to compute Damerau-Levenshtein distance is to incrementally construct
+ * an (m+1)x(n+1) matrix where cell (i, j) represents the minimum number
+ * of operations required to transform the first i characters of s into
+ * the first j characters of t. The last column of the final row is the
+ * answer.
+ *
+ * We use that algorithm here with some modification. In lieu of holding
+ * the entire array in memory at once, we'll just use two arrays of size
+ * m+1 for storing accumulated values. At each step one array represents
+ * the "previous" row and one is the "current" row of the notional large
+ * array.
+ *
+ * If max_d >= 0, we only need to provide an accurate answer when that answer
+ * is less than or equal to the bound. From any cell in the matrix, there is
+ * theoretical "minimum residual distance" from that cell to the last column
+ * of the final row. This minimum residual distance is zero when the
+ * untransformed portions of the strings are of equal length (because we might
+ * get lucky and find all the remaining characters matching) and is otherwise
+ * based on the minimum number of insertions or deletions needed to make them
+ * equal length. The residual distance grows as we move toward the upper
+ * right or lower left corners of the matrix. When the max_d bound is
+ * usefully tight, we can use this property to avoid computing the entirety
+ * of each row; instead, we maintain a start_column and stop_column that
+ * identify the portion of the matrix close to the diagonal which can still
+ * affect the final answer.
+ */
+static int
+#ifdef DAMERAU_LEVENSHTEIN_LESS_EQUAL
+dameraulevenshtein_less_equal_internal(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c, int max_d)
+#else
+dameraulevenshtein_internal(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c)
+#endif
+{
+ int m,
+ n,
+ s_bytes,
+ t_bytes;
+ int *prev;
+ int *curr;
+ int *s_char_len = NULL;
+ int i,
+ j;
+ const char *s_data;
+ const char *t_data;
+ const char *y;
+
+ /*
+ * For dameraulevenshtein_less_equal_internal, we have real variables called
+ * start_column and stop_column; otherwise it's just short-hand for 0 and
+ * m.
+ */
+#ifdef DAMERAU_LEVENSHTEIN_LESS_EQUAL
+ int start_column,
+ stop_column;
+
+#undef START_COLUMN
+#undef STOP_COLUMN
+#define START_COLUMN start_column
+#define STOP_COLUMN stop_column
+#else
+#undef START_COLUMN
+#undef STOP_COLUMN
+#define START_COLUMN 0
+#define STOP_COLUMN m
+#endif
+
+ /* Extract a pointer to the actual character data. */
+ s_data = VARDATA_ANY(s);
+ t_data = VARDATA_ANY(t);
+
+ /* Determine length of each string in bytes and characters. */
+ s_bytes = VARSIZE_ANY_EXHDR(s);
+ t_bytes = VARSIZE_ANY_EXHDR(t);
+ m = pg_mbstrlen_with_len(s_data, s_bytes);
+ n = pg_mbstrlen_with_len(t_data, t_bytes);
+
+ /*
+ * We can transform an empty s into t with n insertions, or a non-empty t
+ * into an empty s with m deletions.
+ */
+ if (!m)
+ return n * ins_c;
+ if (!n)
+ return m * del_c;
+
+ /*
+ * For security concerns, restrict excessive CPU+RAM usage. (This
+ * implementation uses O(m) memory and has O(mn) complexity.)
+ */
+ if (m > MAX_DAMERAU_LEVENSHTEIN_STRLEN ||
+ n > MAX_DAMERAU_LEVENSHTEIN_STRLEN)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("argument exceeds the maximum length of %d bytes",
+ MAX_DAMERAU_LEVENSHTEIN_STRLEN)));
+
+#ifdef DAMERAU_LEVENSHTEIN_LESS_EQUAL
+ /* Initialize start and stop columns. */
+ start_column = 0;
+ stop_column = m + 1;
+
+ /*
+ * If max_d >= 0, determine whether the bound is impossibly tight. If so,
+ * return max_d + 1 immediately. Otherwise, determine whether it's tight
+ * enough to limit the computation we must perform. If so, figure out
+ * initial stop column.
+ */
+ if (max_d >= 0)
+ {
+ int min_theo_d; /* Theoretical minimum distance. */
+ int max_theo_d; /* Theoretical maximum distance. */
+ int net_inserts = n - m;
+
+ min_theo_d = net_inserts < 0 ?
+ -net_inserts * del_c : net_inserts * ins_c;
+ if (min_theo_d > max_d)
+ return max_d + 1;
+ if (ins_c + del_c < sub_c)
+ sub_c = ins_c + del_c;
+ max_theo_d = min_theo_d + sub_c * Min(m, n);
+ if (max_d >= max_theo_d)
+ max_d = -1;
+ else if (ins_c + del_c > 0)
+ {
+ /*
+ * Figure out how much of the first row of the notional matrix we
+ * need to fill in. If the string is growing, the theoretical
+ * minimum distance already incorporates the cost of deleting the
+ * number of characters necessary to make the two strings equal in
+ * length. Each additional deletion forces another insertion, so
+ * the best-case total cost increases by ins_c + del_c. If the
+ * string is shrinking, the minimum theoretical cost assumes no
+ * excess deletions; that is, we're starting no futher right than
+ * column n - m. If we do start further right, the best-case
+ * total cost increases by ins_c + del_c for each move right.
+ */
+ int slack_d = max_d - min_theo_d;
+ int best_column = net_inserts < 0 ? -net_inserts : 0;
+
+ stop_column = best_column + (slack_d / (ins_c + del_c)) + 1;
+ if (stop_column > m)
+ stop_column = m + 1;
+ }
+ }
+#endif
+
+ /*
+ * In order to avoid calling pg_mblen() repeatedly on each character in s,
+ * we cache all the lengths before starting the main loop -- but if all
+ * the characters in both strings are single byte, then we skip this and
+ * use a fast-path in the main loop. If only one string contains
+ * multi-byte characters, we still build the array, so that the fast-path
+ * needn't deal with the case where the array hasn't been initialized.
+ */
+ if (m != s_bytes || n != t_bytes)
+ {
+ int i;
+ const char *cp = s_data;
+
+ s_char_len = (int *) palloc((m + 1) * sizeof(int));
+ for (i = 0; i < m; ++i)
+ {
+ s_char_len[i] = pg_mblen(cp);
+ cp += s_char_len[i];
+ }
+ s_char_len[i] = 0;
+ }
+
+ /* One more cell for initialization column and row. */
+ ++m;
+ ++n;
+
+ /* Previous and current rows of notional array. */
+ prev = (int *) palloc(2 * m * sizeof(int));
+ curr = prev + m;
+
+ /*
+ * To transform the first i characters of s into the first 0 characters of
+ * t, we must perform i deletions.
+ */
+ for (i = START_COLUMN; i < STOP_COLUMN; i++)
+ prev[i] = i * del_c;
+
+ /* Loop through rows of the notional array */
+ for (y = t_data, j = 1; j < n; j++)
+ {
+ int *temp;
+ const char *x = s_data;
+ int y_char_len = n != t_bytes + 1 ? pg_mblen(y) : 1;
+
+#ifdef DAMERAU_LEVENSHTEIN_LESS_EQUAL
+
+ /*
+ * In the best case, values percolate down the diagonal unchanged, so
+ * we must increment stop_column unless it's already on the right end
+ * of the array. The inner loop will read prev[stop_column], so we
+ * have to initialize it even though it shouldn't affect the result.
+ */
+ if (stop_column < m)
+ {
+ prev[stop_column] = max_d + 1;
+ ++stop_column;
+ }
+
+ /*
+ * The main loop fills in curr, but curr[0] needs a special case: to
+ * transform the first 0 characters of s into the first j characters
+ * of t, we must perform j insertions. However, if start_column > 0,
+ * this special case does not apply.
+ */
+ if (start_column == 0)
+ {
+ curr[0] = j * ins_c;
+ i = 1;
+ }
+ else
+ i = start_column;
+#else
+ curr[0] = j * ins_c;
+ i = 1;
+#endif
+
+ /*
+ * This inner loop is critical to performance, so we include a
+ * fast-path to handle the (fairly common) case where no multibyte
+ * characters are in the mix. The fast-path is entitled to assume
+ * that if s_char_len is not initialized then BOTH strings contain
+ * only single-byte characters.
+ */
+ if (s_char_len != NULL)
+ {
+ for (; i < STOP_COLUMN; i++)
+ {
+ int ins;
+ int del;
+ int sub;
+ int trans;
+ int x_char_len = s_char_len[i - 1];
+
+ /*
+ * Calculate costs for insertion, deletion, and substitution.
+ *
+ * When calculating cost for substitution, we compare the last
+ * character of each possibly-multibyte character first,
+ * because that's enough to rule out most mis-matches. If we
+ * get past that test, then we compare the lengths and the
+ * remaining bytes.
+ */
+ ins = prev[i] + ins_c;
+ del = curr[i - 1] + del_c;
+ if (x[x_char_len - 1] == y[y_char_len - 1]
+ && x_char_len == y_char_len &&
+ (x_char_len == 1 || rest_of_char_same(x, y, x_char_len)))
+ sub = prev[i - 1];
+ else
+ sub = prev[i - 1] + sub_c;
+
+
+
+ /* Take the one with minimum cost. */
+ curr[i] = Min(ins, del);
+ curr[i] = Min(curr[i], sub);
+
+ /* Point to next character. */
+ x += x_char_len;
+ }
+ }
+ else
+ {
+ for (; i < STOP_COLUMN; i++)
+ {
+ int ins;
+ int del;
+ int sub;
+ int trans;
+ /* Calculate costs for insertion, deletion, and substitution. */
+ ins = prev[i] + ins_c;
+ del = curr[i - 1] + del_c;
+ sub = prev[i - 1] + ((*x == *y) ? 0 : sub_c);
+
+ /* Take the one with minimum cost. */
+ curr[i] = Min(ins, del);
+ curr[i] = Min(curr[i], sub);
+
+ /* Point to next character. */
+ x++;
+ }
+ }
+
+ /* Swap current row with previous row. */
+ temp = curr;
+ curr = prev;
+ prev = temp;
+
+ /* Point to next character. */
+ y += y_char_len;
+
+#ifdef DAMERAU_LEVENSHTEIN_LESS_EQUAL
+
+ /*
+ * This chunk of code represents a significant performance hit if used
+ * in the case where there is no max_d bound. This is probably not
+ * because the max_d >= 0 test itself is expensive, but rather because
+ * the possibility of needing to execute this code prevents tight
+ * optimization of the loop as a whole.
+ */
+ if (max_d >= 0)
+ {
+ /*
+ * The "zero point" is the column of the current row where the
+ * remaining portions of the strings are of equal length. There
+ * are (n - 1) characters in the target string, of which j have
+ * been transformed. There are (m - 1) characters in the source
+ * string, so we want to find the value for zp where where (n - 1)
+ * - j = (m - 1) - zp.
+ */
+ int zp = j - (n - m);
+
+ /* Check whether the stop column can slide left. */
+ while (stop_column > 0)
+ {
+ int ii = stop_column - 1;
+ int net_inserts = ii - zp;
+
+ if (prev[ii] + (net_inserts > 0 ? net_inserts * ins_c :
+ -net_inserts * del_c) <= max_d)
+ break;
+ stop_column--;
+ }
+
+ /* Check whether the start column can slide right. */
+ while (start_column < stop_column)
+ {
+ int net_inserts = start_column - zp;
+
+ if (prev[start_column] +
+ (net_inserts > 0 ? net_inserts * ins_c :
+ -net_inserts * del_c) <= max_d)
+ break;
+
+ /*
+ * We'll never again update these values, so we must make sure
+ * there's nothing here that could confuse any future
+ * iteration of the outer loop.
+ */
+ prev[start_column] = max_d + 1;
+ curr[start_column] = max_d + 1;
+ if (start_column != 0)
+ s_data += (s_char_len != NULL) ? s_char_len[start_column - 1] : 1;
+ start_column++;
+ }
+
+ /* If they cross, we're going to exceed the bound. */
+ if (start_column >= stop_column)
+ return max_d + 1;
+ }
+#endif
+ }
+
+ /*
+ * Because the final value was swapped from the previous row to the
+ * current row, that's where we'll find it.
+ */
+ return prev[m - 1];
+}
+
+
+#ifdef DAMERAU_LEVENSHTEIN_NONCOMPATIBLE
+static int dameraulevenshtein_internal_noncompatible(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c);
+/*copied from:
+ * http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/tools/perf/util/levenshtein.c
+ */
+
+ /*
+ * This function implements the Damerau-Levenshtein algorithm to
+ * calculate a distance between strings.
+ *
+ * Basically, it says how many letters need to be swapped, substituted,
+ * deleted from, or added to string1, at least, to get string2.
+ *
+ * The idea is to build a distance matrix for the substrings of both
+ * strings. To avoid a large space complexity, only the last three rows
+ * are kept in memory (if swaps had the same or higher cost as one deletion
+ * plus one insertion, only two rows would be needed).
+ *
+ * At any stage, "i + 1" denotes the length of the current substring of
+ * string1 that the distance is calculated for.
+ *
+ * row2 holds the current row, row1 the previous row (i.e. for the substring
+ * of string1 of length "i"), and row0 the row before that.
+ *
+ * In other words, at the start of the big loop, row2[j + 1] contains the
+ * Damerau-Levenshtein distance between the substring of string1 of length
+ * "i" and the substring of string2 of length "j + 1".
+ *
+ * All the big loop does is determine the partial minimum-cost paths.
+ *
+ * It does so by calculating the costs of the path ending in characters
+ * i (in string1) and j (in string2), respectively, given that the last
+ * operation is a substition, a swap, a deletion, or an insertion.
+ *
+ * This implementation allows the costs to be weighted:
+ *
+ * - w (as in "sWap")
+ * - s (as in "Substitution")
+ * - a (for insertion, AKA "Add")
+ * - d (as in "Deletion")
+ *
+ * Note that this algorithm calculates a distance _iff_ d == a.
+ */
+static int dameraulevenshtein_internal_noncompatible(text *s, text *t,
+ int ins_c, int del_c, int sub_c, int trans_c)
+ {
+
+ const char *s_data;
+ const char *t_data;
+
+ int m,
+ n,
+ s_bytes,
+ t_bytes;
+
+ /* Extract a pointer to the actual character data. */
+ s_data = VARDATA_ANY(s);
+ t_data = VARDATA_ANY(t);
+
+ const char *string1 = s_data;
+ const char *string2 = t_data;
+
+ /* Determine length of each string in bytes and characters. */
+ s_bytes = VARSIZE_ANY_EXHDR(s);
+ t_bytes = VARSIZE_ANY_EXHDR(t);
+ /* returns the length (counted in wchars) of a multibyte string
+ * (not necessarily NULL terminated)
+ */
+ m = pg_mbstrlen_with_len(s_data, s_bytes);
+ n = pg_mbstrlen_with_len(t_data, t_bytes);
+
+
+
+ int len1 = m, len2 = n;
+ int *row0 = malloc(sizeof(int) * (len2 + 1));
+ int *row1 = malloc(sizeof(int) * (len2 + 1));
+ int *row2 = malloc(sizeof(int) * (len2 + 1));
+ int i, j;
+
+ for (j = 0; j <= len2; j++)
+ row1[j] = j * ins_c;
+ for (i = 0; i < len1; i++) {
+ int *dummy;
+
+ row2[0] = (i + 1) * del_c;
+ for (j = 0; j < len2; j++) {
+ /* substitution */
+ row2[j + 1] = row1[j] + sub_c * (string1[i] != string2[j]);
+ /* swap */
+ if (i > 0 && j > 0 && string1[i - 1] == string2[j] &&
+ string1[i] == string2[j - 1] &&
+ row2[j + 1] > row0[j - 1] + trans_c)
+ row2[j + 1] = row0[j - 1] + trans_c;
+ /* deletion */
+ if (row2[j + 1] > row1[j + 1] + del_c)
+ row2[j + 1] = row1[j + 1] + del_c;
+ /* insertion */
+ if (row2[j + 1] > row2[j] + ins_c)
+ row2[j + 1] = row2[j] + ins_c;
+ }
+
+ dummy = row0;
+ row0 = row1;
+ row1 = row2;
+ row2 = dummy;
+ }
+
+ i = row1[len2];
+ free(row0);
+ free(row1);
+ free(row2);
+
+ return i;
+ }
+#endif
+
+
diff --git a/contrib/fuzzystrmatch/dameraulevenshtein_new.c b/contrib/fuzzystrmatch/dameraulevenshtein_new.c
new file mode 100644
index 0000000..b182ab5
--- /dev/null
+++ b/contrib/fuzzystrmatch/dameraulevenshtein_new.c
@@ -0,0 +1,87 @@
+ /*copied from:
+ * http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/tools/perf/util/levenshtein.c
+ */
+ #include "cache.h"
+ #include "levenshtein.h"
+
+ /*
+ * This function implements the Damerau-Levenshtein algorithm to
+ * calculate a distance between strings.
+ *
+ * Basically, it says how many letters need to be swapped, substituted,
+ * deleted from, or added to string1, at least, to get string2.
+ *
+ * The idea is to build a distance matrix for the substrings of both
+ * strings. To avoid a large space complexity, only the last three rows
+ * are kept in memory (if swaps had the same or higher cost as one deletion
+ * plus one insertion, only two rows would be needed).
+ *
+ * At any stage, "i + 1" denotes the length of the current substring of
+ * string1 that the distance is calculated for.
+ *
+ * row2 holds the current row, row1 the previous row (i.e. for the substring
+ * of string1 of length "i"), and row0 the row before that.
+ *
+ * In other words, at the start of the big loop, row2[j + 1] contains the
+ * Damerau-Levenshtein distance between the substring of string1 of length
+ * "i" and the substring of string2 of length "j + 1".
+ *
+ * All the big loop does is determine the partial minimum-cost paths.
+ *
+ * It does so by calculating the costs of the path ending in characters
+ * i (in string1) and j (in string2), respectively, given that the last
+ * operation is a substition, a swap, a deletion, or an insertion.
+ *
+ * This implementation allows the costs to be weighted:
+ *
+ * - w (as in "sWap")
+ * - s (as in "Substitution")
+ * - a (for insertion, AKA "Add")
+ * - d (as in "Deletion")
+ *
+ * Note that this algorithm calculates a distance _iff_ d == a.
+ */
+ int levenshtein(const char *string1, const char *string2,
+ int w, int s, int a, int d)
+ {
+ int len1 = strlen(string1), len2 = strlen(string2);
+ int *row0 = malloc(sizeof(int) * (len2 + 1));
+ int *row1 = malloc(sizeof(int) * (len2 + 1));
+ int *row2 = malloc(sizeof(int) * (len2 + 1));
+ int i, j;
+
+ for (j = 0; j <= len2; j++)
+ row1[j] = j * a;
+ for (i = 0; i < len1; i++) {
+ int *dummy;
+
+ row2[0] = (i + 1) * d;
+ for (j = 0; j < len2; j++) {
+ /* substitution */
+ row2[j + 1] = row1[j] + s * (string1[i] != string2[j]);
+ /* swap */
+ if (i > 0 && j > 0 && string1[i - 1] == string2[j] &&
+ string1[i] == string2[j - 1] &&
+ row2[j + 1] > row0[j - 1] + w)
+ row2[j + 1] = row0[j - 1] + w;
+ /* deletion */
+ if (row2[j + 1] > row1[j + 1] + d)
+ row2[j + 1] = row1[j + 1] + d;
+ /* insertion */
+ if (row2[j + 1] > row2[j] + a)
+ row2[j + 1] = row2[j] + a;
+ }
+
+ dummy = row0;
+ row0 = row1;
+ row1 = row2;
+ row2 = dummy;
+ }
+
+ i = row1[len2];
+ free(row0);
+ free(row1);
+ free(row2);
+
+ return i;
+ }
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql b/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
index 1cf9b61..f8881f4 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
+++ b/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
@@ -1,4 +1,4 @@
-/* contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql */
+/* contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
@@ -19,6 +19,26 @@ CREATE FUNCTION levenshtein_less_equal (text,text,int,int,int,int) RETURNS int
AS 'MODULE_PATHNAME','levenshtein_less_equal_with_costs'
LANGUAGE C IMMUTABLE STRICT;
+CREATE FUNCTION dameraulevenshteinnocompatible (text,text,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs_noncompatible'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein (text,text) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein (text,text,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
CREATE FUNCTION metaphone (text,int) RETURNS text
AS 'MODULE_PATHNAME','metaphone'
LANGUAGE C IMMUTABLE STRICT;
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql b/contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql
new file mode 100644
index 0000000..b775e7c
--- /dev/null
+++ b/contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql
@@ -0,0 +1,60 @@
+/* contrib/fuzzystrmatch/fuzzystrmatch--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
+
+CREATE FUNCTION levenshtein (text,text) RETURNS int
+AS 'MODULE_PATHNAME','levenshtein'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION levenshtein (text,text,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','levenshtein_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION levenshtein_less_equal (text,text,int) RETURNS int
+AS 'MODULE_PATHNAME','levenshtein_less_equal'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION levenshtein_less_equal (text,text,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','levenshtein_less_equal_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein (text,text) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein (text,text,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION metaphone (text,int) RETURNS text
+AS 'MODULE_PATHNAME','metaphone'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION soundex(text) RETURNS text
+AS 'MODULE_PATHNAME', 'soundex'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION text_soundex(text) RETURNS text
+AS 'MODULE_PATHNAME', 'soundex'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION difference(text,text) RETURNS int
+AS 'MODULE_PATHNAME', 'difference'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dmetaphone (text) RETURNS text
+AS 'MODULE_PATHNAME', 'dmetaphone'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dmetaphone_alt (text) RETURNS text
+AS 'MODULE_PATHNAME', 'dmetaphone_alt'
+LANGUAGE C IMMUTABLE STRICT;
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql b/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
index b9a805a..39622d1 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
+++ b/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
@@ -1,10 +1,14 @@
-/* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql */
+/* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
+
+ALTER EXTENSION fuzzystrmatch ADD function dameraulevenshteinnoncompatible(text,text,integer,integer,integer,integer);
+ALTER EXTENSION fuzzystrmatch ADD function dameraulevenshtein(text,text);
+ALTER EXTENSION fuzzystrmatch ADD function dameraulevenshtein(text,text,integer,integer,integer,integer);
ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
ALTER EXTENSION fuzzystrmatch ADD function soundex(text);
ALTER EXTENSION fuzzystrmatch ADD function text_soundex(text);
@@ -21,3 +25,15 @@ LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION levenshtein_less_equal (text,text,int,int,int,int) RETURNS int
AS 'MODULE_PATHNAME','levenshtein_less_equal_with_costs'
LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal_noncompatible (text,text,int,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs_noncompatible'
+LANGUAGE C IMMUTABLE STRICT;
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql b/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql
new file mode 100644
index 0000000..0c03a01
--- /dev/null
+++ b/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql
@@ -0,0 +1,33 @@
+/* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
+
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein_less_equal (text,text,int);
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein_less_equal (text,text,int,int,int,int);
+ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
+ALTER EXTENSION fuzzystrmatch ADD function soundex(text);
+ALTER EXTENSION fuzzystrmatch ADD function text_soundex(text);
+ALTER EXTENSION fuzzystrmatch ADD function difference(text,text);
+ALTER EXTENSION fuzzystrmatch ADD function dmetaphone(text);
+ALTER EXTENSION fuzzystrmatch ADD function dmetaphone_alt(text);
+
+-- these functions were not in 9.3
+
+CREATE FUNCTION dameraulevenshtein (text,text) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein (text,text,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal'
+LANGUAGE C IMMUTABLE STRICT;
+
+CREATE FUNCTION dameraulevenshtein_less_equal (text,text,int,int,int,int,int) RETURNS int
+AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs'
+LANGUAGE C IMMUTABLE STRICT;
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c
index 027b0a5..d1850aa 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch.c
+++ b/contrib/fuzzystrmatch/fuzzystrmatch.c
@@ -53,6 +53,10 @@ extern Datum levenshtein_with_costs(PG_FUNCTION_ARGS);
extern Datum levenshtein(PG_FUNCTION_ARGS);
extern Datum levenshtein_less_equal_with_costs(PG_FUNCTION_ARGS);
extern Datum levenshtein_less_equal(PG_FUNCTION_ARGS);
+extern Datum dameraulevenshtein_with_costs(PG_FUNCTION_ARGS);
+extern Datum dameraulevenshtein(PG_FUNCTION_ARGS);
+extern Datum dameraulevenshtein_less_equal_with_costs(PG_FUNCTION_ARGS);
+extern Datum dameraulevenshtein_less_equal(PG_FUNCTION_ARGS);
extern Datum metaphone(PG_FUNCTION_ARGS);
extern Datum soundex(PG_FUNCTION_ARGS);
extern Datum difference(PG_FUNCTION_ARGS);
@@ -193,7 +197,7 @@ levenshtein_with_costs(PG_FUNCTION_ARGS)
int del_c = PG_GETARG_INT32(3);
int sub_c = PG_GETARG_INT32(4);
- PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c));
+ PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c, 0));
}
@@ -204,7 +208,7 @@ levenshtein(PG_FUNCTION_ARGS)
text *src = PG_GETARG_TEXT_PP(0);
text *dst = PG_GETARG_TEXT_PP(1);
- PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1));
+ PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1, 0));
}
@@ -219,7 +223,7 @@ levenshtein_less_equal_with_costs(PG_FUNCTION_ARGS)
int sub_c = PG_GETARG_INT32(4);
int max_d = PG_GETARG_INT32(5);
- PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, ins_c, del_c, sub_c, max_d));
+ PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, ins_c, del_c, sub_c, 0, max_d));
}
@@ -231,9 +235,61 @@ levenshtein_less_equal(PG_FUNCTION_ARGS)
text *dst = PG_GETARG_TEXT_PP(1);
int max_d = PG_GETARG_INT32(2);
- PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, 1, 1, 1, max_d));
+ PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, 1, 1, 1, 0, max_d));
}
+PG_FUNCTION_INFO_V1(dameraulevenshtein_with_costs);
+Datum
+dameraulevenshtein_with_costs(PG_FUNCTION_ARGS)
+{
+ text *src = PG_GETARG_TEXT_PP(0);
+ text *dst = PG_GETARG_TEXT_PP(1);
+ int ins_c = PG_GETARG_INT32(2);
+ int del_c = PG_GETARG_INT32(3);
+ int sub_c = PG_GETARG_INT32(4);
+ int trans_c = PG_GETARG_INT32(5);
+
+ PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c, trans_c));
+}
+
+
+PG_FUNCTION_INFO_V1(dameraulevenshtein);
+Datum
+dameraulevenshtein(PG_FUNCTION_ARGS)
+{
+ text *src = PG_GETARG_TEXT_PP(0);
+ text *dst = PG_GETARG_TEXT_PP(1);
+
+ PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1, 1));
+}
+
+
+PG_FUNCTION_INFO_V1(dameraulevenshtein_less_equal_with_costs);
+Datum
+dameraulevenshtein_less_equal_with_costs(PG_FUNCTION_ARGS)
+{
+ text *src = PG_GETARG_TEXT_PP(0);
+ text *dst = PG_GETARG_TEXT_PP(1);
+ int ins_c = PG_GETARG_INT32(2);
+ int del_c = PG_GETARG_INT32(3);
+ int sub_c = PG_GETARG_INT32(4);
+ int trans_c = PG_GETARG_INT32(5);
+ int max_d = PG_GETARG_INT32(6);
+
+ PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, ins_c, del_c, sub_c, trans_c, max_d));
+}
+
+
+PG_FUNCTION_INFO_V1(dameraulevenshtein_less_equal);
+Datum
+dameraulevenshtein_less_equal(PG_FUNCTION_ARGS)
+{
+ text *src = PG_GETARG_TEXT_PP(0);
+ text *dst = PG_GETARG_TEXT_PP(1);
+ int max_d = PG_GETARG_INT32(2);
+
+ PG_RETURN_INT32(levenshtein_less_equal_internal(src, dst, 1, 1, 1, 1, max_d));
+}
/*
* Calculates the metaphone of an input string.
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.control b/contrib/fuzzystrmatch/fuzzystrmatch.control
index e257f09..6b2832a 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch.control
+++ b/contrib/fuzzystrmatch/fuzzystrmatch.control
@@ -1,5 +1,5 @@
# fuzzystrmatch extension
comment = 'determine similarities and distance between strings'
-default_version = '1.0'
+default_version = '1.1'
module_pathname = '$libdir/fuzzystrmatch'
relocatable = true
diff --git a/contrib/fuzzystrmatch/levenshtein.c b/contrib/fuzzystrmatch/levenshtein.c
index f365556..a1bd105 100644
--- a/contrib/fuzzystrmatch/levenshtein.c
+++ b/contrib/fuzzystrmatch/levenshtein.c
@@ -16,6 +16,12 @@
* inspiration.
* Configurable penalty costs extension is introduced by Volkan
* YAZICI <volkan.yazici@gmail.com>.
+ * Damerau levenshtein variant
+ * Liming Hu <dawninghu@gmail.com>
+ * based on description of the algorithm:
+ * http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
+ * and:
+ * http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/tools/perf/util/levenshtein.c
*/
/*
@@ -23,10 +29,10 @@
*/
#ifdef LEVENSHTEIN_LESS_EQUAL
static int levenshtein_less_equal_internal(text *s, text *t,
- int ins_c, int del_c, int sub_c, int max_d);
+ int ins_c, int del_c, int sub_c, int trans_c, int max_d);
#else
static int levenshtein_internal(text *s, text *t,
- int ins_c, int del_c, int sub_c);
+ int ins_c, int del_c, int sub_c, int trans_c);
#endif
#define MAX_LEVENSHTEIN_STRLEN 255
@@ -34,8 +40,8 @@ static int levenshtein_internal(text *s, text *t,
/*
* Calculates Levenshtein distance metric between supplied strings. Generally
- * (1, 1, 1) penalty costs suffices for common cases, but your mileage may
- * vary.
+ * (1, 1, 1 [, 1]) penalty costs suffices for common cases, but your mileage
+ * may vary.
*
* One way to compute Levenshtein distance is to incrementally construct
* an (m+1)x(n+1) matrix where cell (i, j) represents the minimum number
@@ -66,10 +72,10 @@ static int levenshtein_internal(text *s, text *t,
static int
#ifdef LEVENSHTEIN_LESS_EQUAL
levenshtein_less_equal_internal(text *s, text *t,
- int ins_c, int del_c, int sub_c, int max_d)
+ int ins_c, int del_c, int sub_c, int trans_c, int max_d)
#else
levenshtein_internal(text *s, text *t,
- int ins_c, int del_c, int sub_c)
+ int ins_c, int del_c, int sub_c, int trans_c)
#endif
{
int m,
@@ -275,6 +281,7 @@ levenshtein_internal(text *s, text *t,
int ins;
int del;
int sub;
+ int trans;
int x_char_len = s_char_len[i - 1];
/*
@@ -310,6 +317,7 @@ levenshtein_internal(text *s, text *t,
int ins;
int del;
int sub;
+ int trans;
/* Calculate costs for insertion, deletion, and substitution. */
ins = prev[i] + ins_c;
On Thu, Jul 4, 2013 at 3:59 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
5) Your code copies a function from TOMOYO Linux, which is under GPL2
license, so I believe that this cannot be integrated to Postgres which
is under PostgreSQL license (more permissive). Just based on that some
portions of this code cannot be included in Postgres, I am not sure
but this gives a sufficient reason to reject this patch.
We definitely cannot accept any GPL code into PostgreSQL.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers