Created
October 14, 2019 19:19
-
-
Save kofemann/5d64e1bb05294f26ec75fecc759ede22 to your computer and use it in GitHub Desktop.
chimera db missing procedure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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