camper/deploy/input_is_valid_phone.sql

25 lines
437 B
MySQL
Raw Normal View History

-- Deploy camper:input_is_valid_phone to pg
-- requires: roles
-- requires: schema_public
-- 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;