16 lines
298 B
PL/PgSQL
16 lines
298 B
PL/PgSQL
BEGIN;
|
|
|
|
CREATE FUNCTION is_name(value TEXT) RETURNS BOOLEAN LANGUAGE plpgsql AS $$
|
|
BEGIN
|
|
RETURN value = btrim(value) AND length(value) > 0;
|
|
END;
|
|
$$;
|
|
|
|
CREATE FUNCTION is_language_code(value VARCHAR) RETURNS BOOLEAN LANGUAGE plpgsql
|
|
AS $$
|
|
BEGIN
|
|
RETURN value ~ '^[a-z]{2}$';
|
|
END;
|
|
$$;
|
|
|
|
COMMIT;
|