Revision 12506
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/vegbien.sql | ||
---|---|---|
2400 | 2400 |
CREATE FUNCTION validatable_datasources(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS SETOF text |
2401 | 2401 |
LANGUAGE plpgsql |
2402 | 2402 |
SET search_path TO pg_temp |
2403 |
AS $$ |
|
2403 |
AS $_$
|
|
2404 | 2404 |
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime |
2405 | 2405 |
changes of search_path (schema elements are bound at inline time rather than |
2406 | 2406 |
runtime) */ |
... | ... | |
2410 | 2410 |
PERFORM util.use_schema(schema_anchor); |
2411 | 2411 |
|
2412 | 2412 |
RETURN QUERY |
2413 |
SELECT DISTINCT util.schema(view) FROM validation_views() view; |
|
2413 |
SELECT DISTINCT util.schema(view) |
|
2414 |
FROM validation_views() view |
|
2415 |
WHERE util.schema(view) !~ '_validations$'/*all datasources*/ |
|
2416 |
; |
|
2414 | 2417 |
END; |
2415 |
$$; |
|
2418 |
$_$;
|
|
2416 | 2419 |
|
2417 | 2420 |
|
2418 | 2421 |
-- |
... | ... | |
2422 | 2425 |
CREATE FUNCTION validation_views(schema text DEFAULT NULL::text) RETURNS SETOF regclass |
2423 | 2426 |
LANGUAGE sql STABLE |
2424 | 2427 |
AS $_$ |
2425 |
SELECT * FROM util.show_views_like('^_[[:alpha:]]+_\d+_', |
|
2426 |
(CASE WHEN $1 IS NULL THEN '^(?!.*_validations$)'/*all datasources*/ |
|
2427 |
ELSE util.str_equality_regexp($1) END)) |
|
2428 |
SELECT * FROM util.show_views_like('^_[[:alpha:]]+_\d+_', (CASE WHEN $1 IS NULL |
|
2429 |
THEN ''/*all schemas*/ ELSE util.str_equality_regexp($1) END)) |
|
2428 | 2430 |
$_$; |
2429 | 2431 |
|
2430 | 2432 |
|
Also available in: Unified diff
schemas/util.sql: validation_views(): moved filtering out of _validations schemas to validatable_datasources() so that calling this function with no args gives the validation views in *all schemas as one would expect