From: Jason Stephenson Date: Fri, 8 Apr 2016 19:30:32 +0000 (-0400) Subject: LP#1568046: Fix some mistakes in previous commit. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5a4a6518b5ba10ab3b14bc0bd9530d47096fb29c;p=evergreen%2Fpines.git LP#1568046: Fix some mistakes in previous commit. Looks like a few thinkos crept in from it being dashed off in a hurry. Signed-off-by: Jason Stephenson Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/sql/Pg/006.schema.permissions.sql b/Open-ILS/src/sql/Pg/006.schema.permissions.sql index 9c310fe8ac..c351ba8385 100644 --- a/Open-ILS/src/sql/Pg/006.schema.permissions.sql +++ b/Open-ILS/src/sql/Pg/006.schema.permissions.sql @@ -124,12 +124,12 @@ $$ LANGUAGE SQL STABLE ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_descendants( INT ) RETURNS SETOF permission.grp_tree AS $$ WITH RECURSIVE descendant_depth AS ( SELECT gr.id, - gr.parent, + gr.parent FROM permission.grp_tree gr WHERE gr.id = $1 UNION ALL SELECT gr.id, - gr.parent, + gr.parent FROM permission.grp_tree gr JOIN descendant_depth dd ON (dd.id = gr.parent) ) SELECT gr.* FROM permission.grp_tree gr JOIN descendant_depth USING (id); @@ -137,26 +137,26 @@ $$ LANGUAGE SQL ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_tree_full_path ( INT ) RETURNS SETOF permission.grp_tree AS $$ SELECT * - FROM permission.grp_tree_ancestors($1) + FROM permission.grp_ancestors($1) UNION SELECT * - FROM permission.grp_tree_descendants($1); + FROM permission.grp_descendants($1); $$ LANGUAGE SQL STABLE ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_tree_combined_ancestors ( INT, INT ) RETURNS SETOF permission.grp_tree AS $$ SELECT * - FROM permission.grp_tree_ancestors($1) + FROM permission.grp_ancestors($1) UNION SELECT * - FROM permission.grp_tree_ancestors($2); + FROM permission.grp_ancestors($2); $$ LANGUAGE SQL STABLE ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_tree_common_ancestors ( INT, INT ) RETURNS SETOF permission.grp_tree AS $$ SELECT * - FROM permission.grp_tree_ancestors($1) + FROM permission.grp_ancestors($1) INTERSECT SELECT * - FROM permission.grp_tree_ancestors($2); + FROM permission.grp_ancestors($2); $$ LANGUAGE SQL STABLE ROWS 1; CREATE OR REPLACE FUNCTION permission.usr_perms ( INT ) RETURNS SETOF permission.usr_perm_map AS $$ diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.grp-tree-functions-via-cte.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.grp-tree-functions-via-cte.sql index 7646e99166..28dc0611ab 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.grp-tree-functions-via-cte.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.grp-tree-functions-via-cte.sql @@ -19,12 +19,12 @@ $$ LANGUAGE SQL ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_descendants( INT ) RETURNS SETOF permission.grp_tree AS $$ WITH RECURSIVE descendant_depth AS ( SELECT gr.id, - gr.parent, + gr.parent FROM permission.grp_tree gr WHERE gr.id = $1 UNION ALL SELECT gr.id, - gr.parent, + gr.parent FROM permission.grp_tree gr JOIN descendant_depth dd ON (dd.id = gr.parent) ) SELECT gr.* FROM permission.grp_tree gr JOIN descendant_depth USING (id); @@ -34,26 +34,26 @@ $$ LANGUAGE SQL ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_tree_full_path ( INT ) RETURNS SETOF permission.grp_tree AS $$ SELECT * - FROM permission.grp_tree_ancestors($1) + FROM permission.grp_ancestors($1) UNION SELECT * - FROM permission.grp_tree_descendants($1); + FROM permission.grp_descendants($1); $$ LANGUAGE SQL STABLE ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_tree_combined_ancestors ( INT, INT ) RETURNS SETOF permission.grp_tree AS $$ SELECT * - FROM permission.grp_tree_ancestors($1) + FROM permission.grp_ancestors($1) UNION SELECT * - FROM permission.grp_tree_ancestors($2); + FROM permission.grp_ancestors($2); $$ LANGUAGE SQL STABLE ROWS 1; CREATE OR REPLACE FUNCTION permission.grp_tree_common_ancestors ( INT, INT ) RETURNS SETOF permission.grp_tree AS $$ SELECT * - FROM permission.grp_tree_ancestors($1) + FROM permission.grp_ancestors($1) INTERSECT SELECT * - FROM permission.grp_tree_ancestors($2); + FROM permission.grp_ancestors($2); $$ LANGUAGE SQL STABLE ROWS 1; COMMIT;