The wrong exception was thrown when trying to reference a table that doesn't support references such as a tables in the information schema.