From 4e9cc4842f796c88009f84c83adf95ddcb474f5c Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 7 Sep 2005 22:00:16 +0000 Subject: [PATCH] Performance fix: in postgres, sometimes indexes are not used because of type casting. block_instance.pageid is a big int field so the index wasn't being used. Wrapping in '' prevents the typecast. See http://www.postgresql.org/docs/7.4/interactive/datatype.html#DATATYPE-INT for more information --- lib/blocklib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 0f50035e0ce..ad04eaa49f8 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -598,7 +598,7 @@ function blocks_execute_repositioning(&$instance, $newpos, $newweight) { } function blocks_get_by_page($page) { - $blocks = get_records_select('block_instance', 'pageid = '. $page->get_id() .' AND pagetype = \''. $page->get_type() .'\'', 'position, weight'); + $blocks = get_records_select('block_instance', "pageid = '". $page->get_id() ."' AND pagetype = '". $page->get_type() ."'", 'position, weight'); $positions = $page->blocks_get_positions(); $arr = array();