User Tools

Site Tools


podoc:album_and_subalbums_sql_function

Database Function Description of "album_and_subalbums"

Name

album_and_subalbums

Description

Purpose

Schema

-----  Recursive bulk updates!
 
CREATE OR REPLACE FUNCTION album_and_subalbums(INT) RETURNS SETOF INT AS '
DECLARE
   ident record;
   ident2 record;
BEGIN
   RETURN NEXT $1;
   FOR ident IN SELECT identifier FROM album f WHERE f.parent_album = $1 LOOP
       FOR ident2 IN SELECT * FROM album_and_subalbums(ident.identifier) LOOP
         RETURN NEXT ident2.album_and_subalbums;
        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 album_and_subalbums(INT) RETURNS SETOF INT AS '
DECLARE
   ident record;
   ident2 record;
BEGIN
   RETURN NEXT $1;
   FOR ident IN SELECT identifier FROM album f WHERE f.parent_album = $1 LOOP
       FOR ident2 IN SELECT * FROM album_and_subalbums(ident.identifier) LOOP
         RETURN NEXT ident2.album_and_subalbums;
        END LOOP;
   END LOOP;
 
   RETURN;
END;
' LANGUAGE 'plpgsql';
podoc/album_and_subalbums_sql_function.txt · Last modified: 2007/10/19 15:05 by Luud