[open-ils-commits] r18340 - in branches/rel_1_6_1/Open-ILS/src: perlmods/OpenILS/Application perlmods/OpenILS/Application/Storage/Publisher sql/Pg (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Oct 14 15:42:54 EDT 2010
Author: gmc
Date: 2010-10-14 15:42:49 -0400 (Thu, 14 Oct 2010)
New Revision: 18340
Modified:
branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm
branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
branches/rel_1_6_1/Open-ILS/src/sql/Pg/040.schema.asset.sql
Log:
sort call numbers better regardless of database locale
rel_1_6 version of r18333, accounting for fact that 1.6.x does not
have label_sortkey
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Modified: branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm 2010-10-14 19:40:25 UTC (rev 18339)
+++ branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm 2010-10-14 19:42:49 UTC (rev 18340)
@@ -230,9 +230,9 @@
$table cn
where
not deleted
- and (upper(label) > ? or ( cn.id > ? and upper(label) = ? ))
+ and (cast(upper(label) as bytea) > ? or ( cn.id > ? and cast(upper(label) as bytea) = ? ))
and owning_lib in ($orgs)
- order by upper(label), 4, 2
+ order by cast(upper(label) as bytea), 4, 2
limit $size;
SQL
@@ -285,9 +285,9 @@
$table cn
where
not deleted
- and (upper(label) < ? or ( cn.id < ? and upper(label) = ? ))
+ and (cast(upper(label) as bytea) < ? or ( cn.id < ? and cast(upper(label) as bytea) = ? ))
and owning_lib in ($orgs)
- order by upper(label) desc, 4 desc, 2 desc
+ order by cast(upper(label) as bytea) desc, 4 desc, 2 desc
limit $size
) as bar
order by 1,4,2;
@@ -343,9 +343,9 @@
$table cn
where
not deleted
- and upper(label) < ?
+ and cast(upper(label) as bytea) < ?
and owning_lib in ($orgs)
- order by upper(label) desc, 4 desc, 2 desc
+ order by cast(upper(label) as bytea) desc, 4 desc, 2 desc
limit $topsize
) as bar
order by 1,4,2;
@@ -361,9 +361,9 @@
$table cn
where
not deleted
- and upper(label) >= ?
+ and cast(upper(label) as bytea) >= ?
and owning_lib in ($orgs)
- order by upper(label),4,2
+ order by cast(upper(label) as bytea),4,2
limit $bottomsize;
SQL
Modified: branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm 2010-10-14 19:40:25 UTC (rev 18339)
+++ branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm 2010-10-14 19:42:49 UTC (rev 18340)
@@ -287,7 +287,7 @@
},
{ flesh => 1,
flesh_fields => { acn => [qw/record owning_lib/] },
- order_by => { acn => "upper(label) desc, id desc, owning_lib desc" },
+ order_by => { acn => "cast(upper(label) as bytea) desc, id desc, owning_lib desc" },
limit => $before_limit,
offset => abs($page) * $page_size - $before_offset,
}
@@ -304,7 +304,7 @@
},
{ flesh => 1,
flesh_fields => { acn => [qw/record owning_lib/] },
- order_by => { acn => "upper(label), id, owning_lib" },
+ order_by => { acn => "cast(upper(label) as bytea), id, owning_lib" },
limit => $after_limit,
offset => abs($page) * $page_size - $after_offset,
}
Modified: branches/rel_1_6_1/Open-ILS/src/sql/Pg/040.schema.asset.sql
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/sql/Pg/040.schema.asset.sql 2010-10-14 19:40:25 UTC (rev 18339)
+++ branches/rel_1_6_1/Open-ILS/src/sql/Pg/040.schema.asset.sql 2010-10-14 19:42:49 UTC (rev 18340)
@@ -156,7 +156,7 @@
CREATE INDEX asset_call_number_creator_idx ON asset.call_number (creator);
CREATE INDEX asset_call_number_editor_idx ON asset.call_number (editor);
CREATE INDEX asset_call_number_dewey_idx ON asset.call_number (public.call_number_dewey(label));
-CREATE INDEX asset_call_number_upper_label_id_owning_lib_idx ON asset.call_number (upper(label),id,owning_lib);
+CREATE INDEX asset_call_number_upper_label_id_owning_lib_idx ON asset.call_number (cast(upper(label) as bytea),id,owning_lib);
CREATE UNIQUE INDEX asset_call_number_label_once_per_lib ON asset.call_number (record, owning_lib, label) WHERE deleted IS FALSE;
CREATE RULE protect_cn_delete AS ON DELETE TO asset.call_number DO INSTEAD UPDATE asset.call_number SET deleted = TRUE WHERE OLD.id = asset.call_number.id;
More information about the open-ils-commits
mailing list