[open-ils-commits] r12830 - trunk/Open-ILS/src/sql/Pg (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Apr 9 11:46:52 EDT 2009
Author: erickson
Date: 2009-04-09 11:46:49 -0400 (Thu, 09 Apr 2009)
New Revision: 12830
Modified:
trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql
Log:
go ahead and sort ancestor list by depth so that tree-ification is not strictly required
Modified: trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql 2009-04-09 15:35:26 UTC (rev 12829)
+++ trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql 2009-04-09 15:46:49 UTC (rev 12830)
@@ -145,7 +145,8 @@
FROM connectby('actor.org_unit'::text,'parent_ou'::text,'id'::text,'name'::text,$1::text,100,'.'::text)
AS t(keyid text, parent_keyid text, level int, branch text,pos int)
JOIN actor.org_unit a ON a.id::text = t.keyid::text
- ORDER BY CASE WHEN a.parent_ou IS NULL THEN 0 ELSE 1 END, a.name;
+ JOIN actor.org_unit_type tp ON tp.id = a.ou_type
+ ORDER BY tp.depth, a.name;
$$ LANGUAGE SQL STABLE;
CREATE OR REPLACE FUNCTION actor.org_unit_descendants ( INT,INT ) RETURNS SETOF actor.org_unit AS $$
More information about the open-ils-commits
mailing list