Skip to content

Instantly share code, notes, and snippets.

@kofemann
Created October 14, 2019 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kofemann/5d64e1bb05294f26ec75fecc759ede22 to your computer and use it in GitHub Desktop.
Save kofemann/5d64e1bb05294f26ec75fecc759ede22 to your computer and use it in GitHub Desktop.
chimera db missing procedure
CREATE OR REPLACE FUNCTION inumber2path(bigint, bigint) RETURNS varchar AS $$
DECLARE
inumber bigint := $1;
iroot bigint := $2;
path varchar := '';
entry record;
BEGIN
IF iroot = inumber
THEN
return '/';
END IF;
LOOP
IF iroot = inumber
THEN
EXIT;
END IF;
SELECT * INTO entry FROM t_dirs WHERE ichild = inumber;
IF FOUND AND entry.iparent != inumber
THEN
path := '/' || entry.iname || path;
inumber := entry.iparent;
ELSE
EXIT;
END IF;
END LOOP;
RETURN path;
END;
$$
LANGUAGE 'plpgsql';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment