Index: openacs-4/packages/acs-kernel/sql/postgresql/site-nodes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/site-nodes-create.sql,v diff -u -r1.30.2.1 -r1.30.2.2 --- openacs-4/packages/acs-kernel/sql/postgresql/site-nodes-create.sql 25 Feb 2019 12:29:08 -0000 1.30.2.1 +++ openacs-4/packages/acs-kernel/sql/postgresql/site-nodes-create.sql 14 Mar 2020 19:01:42 -0000 1.30.2.2 @@ -290,23 +290,22 @@ CREATE OR REPLACE FUNCTION site_node__url( url__node_id integer ) RETURNS varchar AS $$ - BEGIN - return ( With RECURSIVE site_nodes_recursion(parent_id, path, directory_p, node_id) as ( + + WITH RECURSIVE site_nodes_path(parent_id, path, directory_p, node_id) as ( select parent_id, ARRAY[name || case when directory_p then '/' else ' ' end]::text[] as path, directory_p, node_id from site_nodes where node_id = url__node_id UNION ALL select sn.parent_id, sn.name::text || snr.path , sn.directory_p, snr.parent_id - from site_nodes sn join site_nodes_recursion snr on sn.node_id = snr.parent_id + from site_nodes sn join site_nodes_path snr on sn.node_id = snr.parent_id where snr.parent_id is not null - ) select array_to_string(path,'/') from site_nodes_recursion where parent_id is null - ); - END; - $$ LANGUAGE plpgsql; + ) select array_to_string(path,'/') from site_nodes_path where parent_id is null + $$ LANGUAGE sql strict stable; + -- recursive site_nodes END ELSE