$table cn
where
not deleted
- and (upper(label) > ? or ( cn.id > ? and upper(label) = ? ))
+ and (cast(upper(label) to bytea) > ? or ( cn.id > ? and cast(upper(label) to bytea) = ? ))
and owning_lib in ($orgs)
- order by upper(label), 4, 2
+ order by cast(upper(label) to bytea), 4, 2
limit $size;
SQL
$table cn
where
not deleted
- and (upper(label) < ? or ( cn.id < ? and upper(label) = ? ))
+ and (cast(upper(label) to bytea) < ? or ( cn.id < ? and cast(upper(label) to bytea) = ? ))
and owning_lib in ($orgs)
- order by upper(label) desc, 4 desc, 2 desc
+ order by cast(upper(label) to bytea) desc, 4 desc, 2 desc
limit $size
) as bar
order by 1,4,2;
$table cn
where
not deleted
- and upper(label) < ?
+ and cast(upper(label) to bytea) < ?
and owning_lib in ($orgs)
- order by upper(label) desc, 4 desc, 2 desc
+ order by cast(upper(label) to bytea) desc, 4 desc, 2 desc
limit $topsize
) as bar
order by 1,4,2;
$table cn
where
not deleted
- and upper(label) >= ?
+ and cast(upper(label) to bytea) >= ?
and owning_lib in ($orgs)
- order by upper(label),4,2
+ order by cast(upper(label) to bytea),4,2
limit $bottomsize;
SQL
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0437'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0438'); -- miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
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) to bytea),id,owning_lib);
CREATE INDEX asset_call_number_label_sortkey ON asset.call_number(cast(label_sortkey as bytea));
CREATE UNIQUE INDEX asset_call_number_label_once_per_lib ON asset.call_number (record, owning_lib, label) WHERE deleted = FALSE OR 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;
--- /dev/null
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0437'); -- miker
+
+DROP INDEX asset.asset_call_number_upper_label_id_owning_lib_idx;
+CREATE INDEX asset_call_number_upper_label_id_owning_lib_idx ON asset.call_number (cast(upper(label) to bytea),id,owning_lib);
+
+COMMIT;