Merged from MOODLE_15_STABLE: 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

This commit is contained in:
mjollnir_ 2005-09-07 22:00:55 +00:00
parent 85430e94cc
commit a9b3afb7b1

View file

@ -738,7 +738,7 @@ function blocks_get_by_page_pinned($page) {
}
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();