Opened 4 years ago

Closed 4 years ago

#18317 closed Bug (fixed)

Raw sql in regressiontests.model_fields.tests.BooleanFieldTests.test_return_type fails with mssql

Reported by: manfre Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


MSSQL calls its user LENGTH function, LEN.

Attachments (1)

django-ticket18317.diff (1.1 KB) - added by manfre 4 years ago.
Adjusts raw SQL depending on connection vendor.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by manfre

Adjusts raw SQL depending on connection vendor.

comment:1 Changed 4 years ago by akaariai

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

I support the idea of allowing the tests to pass on different backends than the core backends.

I am not sure if checking the connection vendor is the right thing to do. Usually we use some connection.ops.sql_for_string_len(), but as this is used just in testing, that does seem wrong approach, too.

How about using something else than LEN() there? It doesn't seem to matter what function is used in there (in fact, you don't need any function in there, right?). So, just get rid of the LEN() call altogether.

comment:2 Changed 4 years ago by Anssi Kääriäinen <akaariai@…>

  • Resolution set to fixed
  • Status changed from new to closed

In [459c3b67b7a9aeb96c9a2d57b18c0987c02f2369]:

Fixed #18317 -- Removed db specific raw SQL function from tests

A test in model_fields used LEN() in raw SQL. This function is not
available on some 3rd party backends. I removed this function and
ensured that the test works correctly (breaks pre e9bbdb39de) with
the change.

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