#31589: Raw queries do not work if any DB content column has the % symbol
               Reporter:  jotauses   |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.0
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  raw query
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
 **Only fails if any DB content column has the % symbol**.

 query_postgresql = """SELECT *, similarity(titulo, '{0}') AS similarity
 FROM pdc_pdc  ORDER BY similarity DESC;"""

 pdc = Pdc.objects.raw(query_postgresql.format(titulo_infocor))

 Column "titulo" content = "This is a test 80%".


   File "C:\Users\-----\AppData\Local\Programs\Python\Python38-32\lib\site-
 packages\django\db\backends\utils.py", line 86, in _execute
     return self.cursor.execute(sql, params)
 IndexError: tuple index out of range

Ticket URL: <https://code.djangoproject.com/ticket/31589>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to