pggeodb.nancy.inra.fr/db_toff - db_toff on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: dropgeometrytable

 

 

Schema

public

 

Owner

postgres

 

Descriptions

args: catalog_name, schema_name, table_name - Drops a table and all its references in geometry_columns.

 

Options

Option

Value

Returns

text

Language

plpgsql

Parameters

catalog_name varchar

schema_name varchar

table_name varchar

 

Definition

CREATE OR REPLACE FUNCTION public.dropgeometrytable (
 catalog_name varchar,
 schema_name varchar,
 table_name varchar
)
RETURNS text AS
$span$
DECLARE

real_schema name;

BEGIN

IF
( schema_name = '' ) THEN
SELECT
current_schema() into real_schema;
ELSE
real_schema = schema_name;
END IF;

-- TODO: Should we warn if table doesn't exist probably instead just saying dropped
-- Remove table

EXECUTE 'DROP TABLE IF EXISTS '
|| quote_ident(real_schema) || '.' ||
quote_ident(table_name) || ' RESTRICT';

RETURN
real_schema || '.' ||
table_name ||' dropped.';

END;
$span$
LANGUAGE
'plpgsql'
VOLATILE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

COMMENT ON FUNCTION public.dropgeometrytable(catalog_name varchar, schema_name varchar, table_name varchar)
IS 'args: catalog_name, schema_name, table_name - Drops a table and all its references in geometry_columns.';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23
Previous topic Chapter index Next topic