numerus/deploy/input_is_valid_phone.sql

25 lines
439 B
PL/PgSQL

-- Deploy numerus:input_is_valid_phone to pg
-- requires: schema_numerus
-- requires: roles
-- requires: extension_pg_libphonenumber
begin;
set search_path to public;
create or replace function input_is_valid_phone(phone text, country text) returns boolean as
$$
begin
begin
perform parse_packed_phone_number(phone, country);
return true;
exception when others then
return false;
end;
end;
$$
language plpgsql
stable;
commit;