camper/deploy/input_is_valid.sql

24 lines
382 B
PL/PgSQL

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