#29257: If creation of a db cursor fails, the resulting traceback is misleading
-------------------------------------+-------------------------------------
     Reporter:  Jerome Leclanche     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Jacob Walls):

 What about something like this? With postgres you can disable server side
 cursors and then attempt to use them. I haven't made it as far as to set
 up postgres so I can run this test, but if you decide to give it a shot
 let me know what you see.

 Also I don't know what type of error we are expecting to get back.

 {{{
 diff --git a/tests/backends/postgresql/test_server_side_cursors.py
 b/tests/backends/postgresql/test_server_side_cursors.py
 index 0cc3423a9b..1b0e4484a3 100644
 --- a/tests/backends/postgresql/test_server_side_cursors.py
 +++ b/tests/backends/postgresql/test_server_side_cursors.py
 @@ -4,6 +4,7 @@ from collections import namedtuple
  from contextlib import contextmanager

  from django.db import connection, models
 +from django.db.utils import DatabaseError
  from django.test import TestCase

  from ..models import Person
 @@ -87,3 +88,9 @@ class ServerSideCursorsPostgres(TestCase):

          with self.override_db_setting(DISABLE_SERVER_SIDE_CURSORS=True):
              self.asserNotUsesCursor(Person.objects.iterator())
 +
 +    def test_close_nonexistent_cursor(self):
 +        persons = Person.objects.iterator()
 +        with self.override_db_setting(DISABLE_SERVER_SIDE_CURSORS=True):
 +            # Attempt to create server-side cursor
 +            self.assertRaises(DatabaseError, next(persons))
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29257#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1c7f88fbc2be6393ce2af383996e231b%40djangoproject.com.

Reply via email to