I need to parse phone numbers in a postgresql function. I am using waterline ORM and was basically doing this computation in javascript. Now I want to move the entire logic to postgresql stored function. But the bottleneck is the availability of libphonenumber library. It's available in Node.js but not sure how to use it in postgresql.
Any idea ?
Since it's available in C++ and JavaScript, you could:
Install and load PL/V8 and use it as a JavaScript library in a PL/V8 stored procedure; or
Write a C extension for PostgreSQL that exposes the functions as SQL-callable functions by wrapping the C++ functions in the C++ version of the library.
Needless to say, the former is probably easier, unless you're comfortable with C programming.