Opened 3 years ago

Closed 3 years ago

#19873 closed Bug (duplicate)

Cursor vs DebugCursor behavior not the same on execute without arguments

Reported by: g.starck@… Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In [1]: from django.conf import settings

In [2]: settings.DEBUG
Out[2]: True

In [3]: from django.db import connection

In [4]: c = connection.cursor()

In [5]: type(c)
Out[5]: django.db.backends.util.CursorDebugWrapper

In [6]: c.execute("SELECT '%%';")

In [7]: c.fetchone()
Out[7]: ('%',)

In [8]:

In [8]: settings.DEBUG = False

In [9]:

In [9]: c = connection.cursor()

In [10]: type(c)
Out[10]: django.db.backends.util.CursorWrapper

In [11]: c.execute("SELECT '%%';")

In [12]: c.fetchone()
Out[12]: ('%%',)

In [13]:

=>

Out[7]: ('%',) vs Out[12]: ('%%',)

(if you explicitly give an empty arguments to execute then it's ok/ there is no diff between Cursor and DebugCursor)

Attachments (1)

0001-19873-DebugCursor.execute-default-args-to-None.patch (755 bytes) - added by gst 3 years ago.
simple workaround / fix

Download all attachments as: .zip

Change History (2)

Changed 3 years ago by gst

simple workaround / fix

comment:1 Changed 3 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #9055

Note: See TracTickets for help on using tickets.
Back to Top