From: Sandro Santilli Date: Tue, 23 Jun 2015 12:41:04 +0000 (+0000) Subject: Reduce number of queries by one within ST_ModEdgeSplit X-Git-Tag: 2.2.0rc1~340 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b262fcba6e106675c893d31f8d584219694a0add;p=postgis Reduce number of queries by one within ST_ModEdgeSplit Uses "INSERT RETURNING" rather than "SELECT" and "INSERT" for getting the identifier of new node. git-svn-id: http://svn.osgeo.org/postgis/trunk@13689 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/topology/sql/sqlmm.sql.in b/topology/sql/sqlmm.sql.in index 79e1bd241..dab993d0f 100644 --- a/topology/sql/sqlmm.sql.in +++ b/topology/sql/sqlmm.sql.in @@ -2183,23 +2183,15 @@ BEGIN END LOOP; -- - -- Get new node id - -- - FOR rec IN EXECUTE 'SELECT nextval(''' || - atopology || '.node_node_id_seq'')' - LOOP - nodeid = rec.nextval; - END LOOP; - - --RAISE NOTICE 'Next node id = % ', nodeid; - - -- - -- Add the new node + -- Add the new node, returning its identifier -- EXECUTE 'INSERT INTO ' || quote_ident(atopology) - || '.node(node_id, geom) VALUES($1, $2)' + || '.node(node_id, geom) VALUES(DEFAULT, $2) RETURNING node_id' + INTO nodeid USING nodeid,apoint; + --RAISE NOTICE 'Next node id = % ', nodeid; + -- -- Compute new edge --