rows_where 参数未传递给 pgr_nodenetwork

rows_where argument not passed to pgr_nodenetwork

我正在使用 pgrouting 扩展的 pgr_NodeNetwork 函数来处理包含线串几何图形(本质上是道路)的 table。

语法如下:

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_where 仅用于处理条件 rows_where 为真的行。

但是,在开始执行时,会引发以下通知:

NOTICE:     pgr_nodeNetwork('my_table', 0.0001, 'id', 'the_geom', 'noded', '<NULL>',  f)

您可以看到 通知没有考虑传递给函数 rows_where 参数(在我的示例中,它是 'id < 10').

此外,这似乎不仅仅是通知本身的显示问题,因为处理一个 table 数百万行需要几个小时,而如果条件 'id < 10' 确实已被考虑在内(因为它将是一个少于 10 行的 table)。

另一方面,如果我们探索函数本身的代码,它的开头是:

    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;

如果你在开头定义另一个具有相同参数和相同RAISE NOTICE指令的函数,你会看到该函数引发的通知正确地再现了用户传递的rows_where参数.

有没有人能解释为什么 rows_where 参数似乎被 pgr_nodeNetwork 函数完全忽略,而用完全相同的代码定义一个全新的函数却不会产生结果相同?

这似乎是一个错误 (https://github.com/pgRouting/pgrouting/issues/1074)。虽然扩展本身没有修复,但我提供了一个替代(自定义)函数(参见上面的 link)。