2026 |
2026 |
|
2027 |
2027 |
|
2028 |
2028 |
--
|
2029 |
|
-- Name: query_relations(regclass, integer); Type: FUNCTION; Schema: public_validations; Owner: -
|
|
2029 |
-- Name: query_relations(regclass, integer, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
|
2030 |
2030 |
--
|
2031 |
2031 |
|
2032 |
|
CREATE FUNCTION query_relations(query_view regclass, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len()) RETURNS SETOF regclass
|
|
2032 |
CREATE FUNCTION query_relations(query_view regclass, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len(), schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS SETOF regclass
|
2033 |
2033 |
LANGUAGE sql STABLE
|
2034 |
2034 |
AS $_$
|
2035 |
2035 |
SELECT * FROM util.show_relations_like(
|
2036 |
|
util.truncated_prefixed_name_regexp(util.name($1), $2))
|
|
2036 |
util.truncated_prefixed_name_regexp(util.name($1), $2),
|
|
2037 |
(CASE WHEN util.schema($1) = util.schema($3) -- is in public_validations?
|
|
2038 |
THEN '' -- output query, so remove in *all* schemas
|
|
2039 |
ELSE util.schema_regexp($1) --input query, so remove only in datasource's schema
|
|
2040 |
END)
|
|
2041 |
)
|
2037 |
2042 |
$_$;
|
2038 |
2043 |
|
2039 |
2044 |
|
2040 |
2045 |
--
|
2041 |
|
-- Name: FUNCTION query_relations(query_view regclass, max_prefix_len integer); Type: COMMENT; Schema: public_validations; Owner: -
|
|
2046 |
-- Name: FUNCTION query_relations(query_view regclass, max_prefix_len integer, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
|
2042 |
2047 |
--
|
2043 |
2048 |
|
2044 |
|
COMMENT ON FUNCTION query_relations(query_view regclass, max_prefix_len integer) IS '
|
|
2049 |
COMMENT ON FUNCTION query_relations(query_view regclass, max_prefix_len integer, schema_anchor anyelement) IS '
|
|
2050 |
query_view: if an output query, will remove in *all* schemas
|
2045 |
2051 |
max_prefix_len: when str may have been truncated (eg. as a table name) due to
|
2046 |
2052 |
the prepending of a prefix, support prefixes up to this length. should be
|
2047 |
2053 |
left as the default value.
|
|
2054 |
schema_anchor: identifies this function''s schema. should be left as the default.
|
2048 |
2055 |
';
|
2049 |
2056 |
|
2050 |
2057 |
|
schemas/util.sql: query_relations(): support passing in an input query instead of an output query, which will remove only in the datasource's schema. (note that it was not clear that passing in an input-side query was not previously supported.)