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

Function: topogeom_remelement

 

 

Schema

topology

 

Owner

postgres

 

Descriptions

args: tg, el - Remove an element from the definition of a TopoGeometry

 

Options

Option

Value

Returns

topology.topogeometry

Language

plpgsql

Parameters

tg topology.topogeometry

el topology.topoelement

 

Definition

CREATE OR REPLACE FUNCTION topology.topogeom_remelement (
 tg topology.topogeometry,
 el topology.topoelement
)
RETURNS topology.topogeometry AS
$span$
DECLARE

 toponame TEXT;
 sql TEXT;
BEGIN

 -- Get topology name
 BEGIN
   SELECT name
   FROM
topology.topology
     INTO STRICT toponame WHERE id = topology_id(tg);
 EXCEPTION
   WHEN
NO_DATA_FOUND THEN
     RAISE EXCEPTION
'No topology with name "%" in topology.topology',
       atopology;
 END;

 -- Delete the element
 sql := format('DELETE FROM %s.relation WHERE '
        'topogeo_id = $1 AND layer_id = $2 AND '
        'element_id = $3 AND element_type = $4'
,
        quote_ident(toponame));
 EXECUTE sql USING id(tg), layer_id(tg), el[1], el[2];

 RETURN tg;

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

COMMENT ON FUNCTION topology.topogeom_remelement(tg topology.topogeometry, el topology.topoelement)
IS 'args: tg, el - Remove an element from the definition of a TopoGeometry';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 26/02/2014 11:51
Previous topic Chapter index Next topic