ORM masks exception in Python shells
|Reported by:||frankwiles||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you have a simple model and add a field to it, creating a South migration, but neglect to run the migration querying the model returns an empty list rather than raising an exception. Properly raises DatabaseError in a template however.
Steps to reproduce:
- Create a simple model named say TestModel with a field.
- Populate it with some data.
- Create initial migration.
- fake your initial
- Add a new field
- Create migration or not, but in either case do not run it to alter the table
- run TestModel.objects.all() in Python shell (also happens in IPython) and it returns 
When visiting a view that uses that same QuerySet it properly raises a DatabaseError (from a psycopg2 ProgrammingError), but not in the shell. I couldn't find any place in the backend where it's being caught and silently ignored. Attached template debug page.