Alright....
I coded a new function for fs_connect_by:
It sorts the file-storage not chronologically, which is REALLY messy, but alphabetically.
Additionally to that all files inside a folder appear alphabetically IN FRONT of the sub-folders.
create function fs_connect_by(integer) returns text as '
declare
id alias for $1;
pid integer;
title varchar;
folder varchar;
BEGIN
select into pid parent_id from fs_files where id = file_id;
select into title lower(file_title) from fs_files where id = file_id;
select into folder folder_p from fs_files where id = file_id;
IF pid is null
THEN
return folder || ''/'' || title || ''/'' || fs_gen_key(id);
ELSE
return fs_connect_by_new(pid) || ''/'' || folder || ''/'' || title || ''/'' || fs_gen_key(id);
END IF;
END;
' language 'plpgsql';
If I made a mistake, go ahead an tell me...