postgresql_16:9.6.17.4 Metaphone
PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > fuzzystrmatch — determine string similarities and distance > Metaphone
Metaphone, like Soundex, is based on the idea of constructing a representative code for an input string. Two strings are then deemed similar if they have the same codes.
This function calculates the metaphone code of an input string:
metaphone(source text, max_output_length int) returns text
source has to be a non-null string with a maximum of 255 characters. max_output_length sets the maximum length of the output metaphone code; if longer, the output is truncated to this length.
Example:
test=# SELECT metaphone('GUMBO', 4);
metaphone
-----------
KM
(1 row)