we've recently updated a website to EE 2.9.3, but when linking to an non existent page, it should redirect to a 404 page. Instead, we get this:

Error Number: 1054

Unknown column 'order' in 'order clause'

SELECT route_parsed, template_name, group_name FROM (exp_templates) JOIN exp_template_routes ON exp_templates.template_id = exp_template_routes.template_id JOIN exp_template_groups ON exp_templates.group_id = exp_template_groups.group_id WHERE route_parsed is not null AND exp_templates.site_id = '1' ORDER BY order, group_name, template_name ASC

Filename: libraries/Template_router.php

Line Number: 83

Now, I checked the database and there is indeed no 'order' in exp_templates. To know what type this field should be, I did a clean install elsewhere on 2.9.3 and noticed this field isn't there at all. The request to it though, in Template_router.php, is.

Any ideas?


  • That's a bug! Definitely why I let others be early adopters... I would definitely revert to 2.9.2 and file this with Ellis. support.ellislab.com/bugs
    – jrothafer
    Apr 2, 2015 at 14:42
  • I have added an 'order' field to this table, with type INT. It works, but ofcourse, I'm not sure if this is the intended type of this field. If anyone knows, shoot! ;)
    – Rien
    Apr 15, 2015 at 8:40
  • For your info, omeone on the EllisLab forums suggested this: "The order column is on the template_routes table, which is joined to in that query. If you’re upgrading then maybe this table is empty? That would certainly count as a bug. Try going to Design > Templates > Template Route Manager and click the “Update” button at the bottom. This should update the contents of the template_routes table to have values for your templates. If this doesn’t work, you may want to submit a bug to the bug tracker, which you may want to do anyway."When doing so, though, it gives me the exact same error.
    – Rien
    Apr 16, 2015 at 5:50

1 Answer 1


Thought I'd contribute an 'answer' as I hate unanswered questions!

You are correct in your comment, I have looked at the upgrade files with a fresh install of 2.9.3 and the order column you mention is actually added during the upgrade to EE 2.9.0. There is an excerpt below :

 * Add a column to the Template Routes table for storing the parse order
 * @access private
 * @return void
private function _update_template_routes_table()
            'order' => array(
                'type'          => 'int',
                'constraint'    => 10,
                'unsigned'      => TRUE,
                'null'          => TRUE

As you can see, it is indeed a column of type INT, also to answer your question on the type of the field, as you can see it is an `order` INT(10) unsigned DEFAULT NULL in SQL syntax.

As to why this column was not added during your update, I can't be sure, and this is definatly something to report to ElliLabs as an upgrade bug. Remember you mention what version you are upgrading from too!

However, with the above info you should be able to at least replicate this missed upgrade. In case it helps I can confirm that there are no database changes at all from 2.9.0 to 2.9.2, there are a few changes in 2.9.0 and 2.9.3, prior to 2.9.0 upgrade the last database change was upgrading to 2.8.0 (there's a number of changes here!).

In case your interested the updates with version numbers are in the folder /system/installer/updates/* prior to installing, obviously once you've deleted your install folder these files are gone! You can read them and make sure the changes have been applied to help you debug what went wrong and where during upgrade.

Hope this helps at least re-assure you that your patch is right!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.