Postgresql 行\其中参数未传递给pgr\ u节点网络
我正在使用Postgresql 行\其中参数未传递给pgr\ u节点网络,postgresql,geometry,geography,pgrouting,Postgresql,Geometry,Geography,Pgrouting,我正在使用pgrouting扩展的函数来处理包含线串几何图形(基本上是道路)的表 语法如下所示: select pgr_nodeNetwork(edge_table:='my_table', tolerance:=0.0001, id:='id', the_geom:='the_geom', table_ending:='noded', rows_where:='id < 10', outall:=false); 您可以看到,通知没有考虑传递给函数的rows\u where参数(在我
pgrouting
扩展的函数来处理包含线串几何图形(基本上是道路)的表
语法如下所示:
select pgr_nodeNetwork(edge_table:='my_table',
tolerance:=0.0001,
id:='id',
the_geom:='the_geom',
table_ending:='noded',
rows_where:='id < 10',
outall:=false);
您可以看到,通知没有考虑传递给函数的rows\u where
参数(在我的示例中,它是'id<10'
)
此外,这似乎不仅仅是通知本身的显示问题,因为处理一个有数百万行的表需要几个小时,而如果真正考虑到条件'id<10'
,处理速度应该非常快(因为它将是一个不到10行的表)
另一方面,如果我们探究函数本身的代码,它将从以下内容开始:
CREATE OR REPLACE FUNCTION sig.pgr_nodenetwork(
edge_table text,
tolerance double precision,
id text DEFAULT 'id'::text,
the_geom text DEFAULT 'the_geom'::text,
table_ending text DEFAULT 'noded'::text,
rows_where text DEFAULT ''::text,
outall boolean DEFAULT false)
....
raise notice 'pgr_nodeNetwork(''%'', %, ''%'', ''%'', ''%'', ''%'', %)',
edge_table, tolerance, id, the_geom, table_ending, rows_where, outall;
如果您在开始时使用相同的参数和相同的raisenotice
指令定义另一个函数,您将看到该函数发出的通知正确地再现了用户传递的rows\u where
参数
有人解释过为什么pgr\u nodeNetwork函数似乎完全忽略了rows\u where
参数,而用完全相同的代码定义一个全新的函数却不能产生相同的结果吗?这似乎是一个bug()。虽然扩展本身并没有固定,但我提供了一个可选(自定义)函数(参见上面的链接)
CREATE OR REPLACE FUNCTION sig.pgr_nodenetwork(
edge_table text,
tolerance double precision,
id text DEFAULT 'id'::text,
the_geom text DEFAULT 'the_geom'::text,
table_ending text DEFAULT 'noded'::text,
rows_where text DEFAULT ''::text,
outall boolean DEFAULT false)
....
raise notice 'pgr_nodeNetwork(''%'', %, ''%'', ''%'', ''%'', ''%'', %)',
edge_table, tolerance, id, the_geom, table_ending, rows_where, outall;