User Tools

Site Tools


podoc:folder_and_subfolders_sql_function

Database Function Description of "folder_and_subfolders"

Name

folder_and_subfolders

Description

Purpose

Schema

-----  Recursive bulk updates!
 
CREATE OR REPLACE FUNCTION folder_and_subfolders(INT) RETURNS SETOF INT AS '
DECLARE
   ident record;
   ident2 record;
BEGIN
   RETURN NEXT $1;
   FOR ident IN SELECT identifier FROM folder f WHERE f.parent_folder = $1 LOOP
       FOR ident2 IN SELECT * FROM folder_and_subfolders(ident.identifier) LOOP
         RETURN NEXT ident2.folder_and_subfolders;
        END LOOP;
   END LOOP;
 
   RETURN;
END;
' LANGUAGE 'plpgsql';

History

Used first

Version 2.34

Used last

Still in use

Change history

= Version 2.34 =

-----  Recursive bulk updates!
 
CREATE OR REPLACE FUNCTION folder_and_subfolders(INT) RETURNS SETOF INT AS '
DECLARE
   ident record;
   ident2 record;
BEGIN
   RETURN NEXT $1;
   FOR ident IN SELECT identifier FROM folder f WHERE f.parent_folder = $1 LOOP
       FOR ident2 IN SELECT * FROM folder_and_subfolders(ident.identifier) LOOP
         RETURN NEXT ident2.folder_and_subfolders;
        END LOOP;
   END LOOP;
 
   RETURN;
END;
' LANGUAGE 'plpgsql';
podoc/folder_and_subfolders_sql_function.txt · Last modified: 2007/10/19 11:05 by Luud