Schema
Owner
postgres
Descriptions
args: tg, el - Remove an element from the definition of a TopoGeometry
Options
Option | Value |
---|---|
Returns |
topology.topogeometry |
Language |
|
Parameters |
tg topology.topogeometry in 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 07/12/2018 13:23 |