]> git.evergreen-ils.org Git - working/Evergreen.git/commit
LP#1851413: Restore assumed order of full_path
authorMike Rylander <mrylander@gmail.com>
Tue, 5 Nov 2019 17:30:10 +0000 (12:30 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 11 Sep 2020 15:08:26 +0000 (11:08 -0400)
commitcbef8a4e04d7424da0b6f241f6b2ad35841d63e9
tree1eae1f78287b6e64c9eda8ec39c67bcbc76c876a
parentb51b2c3c4ec8ed22764fdcc719a2ad813a0da083
LP#1851413: Restore assumed order of full_path

Some code, including UI rendering code in the reporting interfaces,
assumes that the order of the full_path stored procedure will be the
same as for the ancestors and descendants procedures, which is tree
order from top to bottom. However, because the full_path procedure
simply UNIONs the other two together without an explicit ORDER BY,
that may not be -- and for org hierarchies that have been modified
heavily, often is not -- the case in practice. This is due to
internals of query planning in Postgres.

The easiest place to see this issues is in the report interface.
Select a template folder that is not currently shared, choose Manage
Folder, select Share Folder, click Go, and see the dropdown of options.
Under some circumstances, the list of org units in the dropdown there
are incorrectly ordered (should be from top of the tree down), and some
that should be available are disabled.

This commit uses the org unit type depth to order the output as assumed.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/sql/Pg/020.schema.functions.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.function.restore_full_path_order.sql [new file with mode: 0644]