numerus/deploy/input_is_valid.sql

24 lines
384 B
PL/PgSQL

-- Deploy numerus:input_is_valid to pg
-- requires: schema_numerus
-- requires: roles
begin;
set search_path to public;
create or replace function input_is_valid(input text, domname text) returns boolean as
$$
begin
begin
execute format('select %L::%s', input, domname);
return true;
exception when others then
return false;
end;
end;
$$
language plpgsql
stable;
commit;