Database reference - postgis

postgis -  functions -  public.dropgeometrytable

Description

none

Function properties

namevalue
namepublic.dropgeometrytable
return typepg_catalog.text 
languageSQL
deterministicNO

Usage

result = public.dropgeometrytable();

Code

CREATE FUNCTION dropgeometrytable(character varying, character varying, character varying) RETURNS text
    AS $_$
DECLARE
    catalog_name alias for $1; 
    schema_name alias for $2;
    table_name alias for $3;
    real_schema name;

BEGIN


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


    -- Remove refs from geometry_columns table
    EXECUTE 'DELETE FROM geometry_columns WHERE ' ||

        'f_table_schema = ' || quote_literal(real_schema) ||
        ' AND ' ||

        ' f_table_name = ' || quote_literal(table_name);
    
    -- Remove table 
    EXECUTE 'DROP TABLE '

        || quote_ident(real_schema) || '.' ||

        quote_ident(table_name);

    RETURN

        real_schema || '.' ||

        table_name ||' dropped.';
    
END;
$_$
    LANGUAGE plpgsql STRICT;




Documentation generated by SqlSpec