Schema
Owner
postgres
Descriptions
args: ovschema, ovtable, ovcolumn - Untag a raster column from being an overview of another.
Options
Option | Value |
---|---|
Returns |
boolean |
Language |
|
Parameters |
ovschema name ovtable name ovcolumn name |
Definition
CREATE OR REPLACE FUNCTION public.dropoverviewconstraints (
ovschema name,
ovtable name,
ovcolumn name
)
RETURNS boolean AS
$span$
DECLARE
schema name;
sql text;
rtn boolean;
BEGIN
-- validate schema
schema := NULL;
IF length($1) > 0 THEN
sql := 'SELECT nspname FROM pg_namespace '
|| 'WHERE nspname = ' || quote_literal($1)
|| 'LIMIT 1';
EXECUTE sql INTO schema;
IF schema IS NULL THEN
RAISE EXCEPTION 'The value provided for schema is invalid';
RETURN FALSE;
END IF;
END IF;
IF schema IS NULL THEN
sql := 'SELECT n.nspname AS schemaname '
|| 'FROM pg_catalog.pg_class c '
|| 'JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace '
|| 'WHERE c.relkind = ' || quote_literal('r')
|| ' AND n.nspname NOT IN (' || quote_literal('pg_catalog')
|| ', ' || quote_literal('pg_toast')
|| ') AND pg_catalog.pg_table_is_visible(c.oid)'
|| ' AND c.relname = ' || quote_literal($2);
EXECUTE sql INTO schema;
IF schema IS NULL THEN
RAISE EXCEPTION 'The table % does not occur in the search_path', quote_literal($2);
RETURN FALSE;
END IF;
END IF;
rtn := public._drop_overview_constraint(schema, $2, $3);
IF rtn IS FALSE THEN
RAISE EXCEPTION 'Unable to drop the overview constraint . Is the schema name, table name or column name incorrect?';
RETURN FALSE;
END IF;
RETURN TRUE;
END;
$span$
LANGUAGE 'plpgsql'
VOLATILE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST 100;
COMMENT ON FUNCTION public.dropoverviewconstraints(ovschema name, ovtable name, ovcolumn name)
IS 'args: ovschema, ovtable, ovcolumn - Untag a raster column from being an overview of another.';
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23 |