Projet

Général

Profil

Bug #6283

crash sql: "operator does not exist: text[] && integer[]" lors d'une intersection

Ajouté par Thomas Noël il y a plus de 9 ans. Mis à jour il y a plus de 8 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
12 janvier 2015
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Juste raté cette trace vendredi soir (pas vue sur l'écran, parce que ajax)

La requête : https://fsb.dev.au-quotidien.com/admin/users/?ajax=true&offset=0&limit=20&q=toto&filter=true&role=1

Subject: Quixote Traceback (ProgrammingError: operator does not exist: text[] &&
        integer[]

LINE 1: SELECT count(*) FROM users WHERE ( roles && ARRAY['1', 1] ) ...
                                                 ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
)
To: tnoel+fsb-dev@entrouvert.com

Exception:
  type = '<class 'psycopg2.ProgrammingError'>', value = 'operator does not exist: text[] && integer[]
LINE 1: SELECT count(*) FROM users WHERE ( roles && ARRAY['1', 1] ) ...
                                                 ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
'

Stack trace (most recent call first):
  File "/usr/lib/python2.7/dist-packages/wcs/sql.py", line 555, in count
   553             sql_statement += ' WHERE ' + ' AND '.join(where_clauses)
   554         conn, cur = get_connection_and_cursor()
>  555         cur.execute(sql_statement, parameters)
   556         count = cur.fetchone()[0]
   557         conn.commit()

  locals:
     func_clause = None
     sql_statement = 'SELECT count(*) FROM users WHERE ( roles && %(c41921792)s ) AND ( name ILIKE %(c59873248)s OR email ILIKE
%(c59872768)s )'
     cur = <cursor object at 0x3688a00; closed: 0>
     parameters = {'c59873248': '%toto%', 'c59872768': '%toto%', 'c41921792': ['1', 1]}
     clause = [<wcs.qommon.storage.Or object at 0x374bcd0>, <wcs.qommon.storage.Or object at 0x374b190>]
     cls = <class 'sql.SqlUser'>
     conn = <connection object at 0x38503c0; dsn: 'dbname=wcs_fsb_dev_au_quotidien_com', closed: 0>
     where_clauses = ['( roles && %(c41921792)s )', '( name ILIKE %(c59873248)s OR email ILIKE %(c59872768)s )']

  File "/usr/lib/python2.7/dist-packages/wcs/sql.py", line 253, in f
   251         except psycopg2.Error:
   252             get_connection().rollback()
>  253             raise
   254     return f
   255

  locals:
     args = (<class 'sql.SqlUser'>, [<wcs.qommon.storage.Or object at 0x374bcd0>, <wcs.qommon.storage.Or object at 0x374b190>])
     func = <function count at 0x373a668>
     kwargs = {}

  File "/usr/lib/python2.7/dist-packages/wcs/admin/users.py", line 360, in _q_index
   358
   359         if criterias:
>  360             filtered_count = get_publisher().user_class.count(criterias)
   361             if filtered_count < offset:
   362                 # reset offset if we are past the number of elements

  locals:
     ident_methods = ['idp']
     other_roles_set = set(['1', 1])
     criterias = [<wcs.qommon.storage.Or object at 0x374bcd0>, <wcs.qommon.storage.Or object at 0x374b190>]
     total_count = 5L
     self = <wcs.admin.users.UsersDirectory object at 0x2e49190>
     other_role = '1'
     offset = 0
     r = <TemplateIO object at 0x3518b90>
     limit = 20
     x = '1'
     query = 'toto'
     other_roles = ['1']
     checked_roles = ['1']
     possible_roles = ['admin', 'none', '2', '1']

  File "/usr/lib/pymodules/python2.7/quixote/directory.py", line 67, in _q_traverse
    65                 raise TraversalError
    66         elif hasattr(obj, '__call__'):
>   67             return obj()
    68         else:
    69             return obj

  locals:
     component = ''
     self = <wcs.admin.users.UsersDirectory object at 0x2e49190>
     obj = <bound method UsersDirectory._q_index of <wcs.admin.users.UsersDirectory object at 0x2e49190>>
     name = '_q_index'
     path = []


Fichiers

Historique

#1

Mis à jour par Frédéric Péters il y a plus de 9 ans

Hack sur hack, en attendant #6222.

#2

Mis à jour par Thomas Noël il y a plus de 9 ans

Ack !

#3

Mis à jour par Frédéric Péters il y a plus de 9 ans

  • Statut changé de En cours à Résolu (à déployer)
commit 1e2ecdbe4e8bf241d8621086d5c5acc7f8da3249
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Mon Jan 12 14:02:49 2015 +0100

    admin: do not add int variants of roles in SQL mode (#6283)
#4

Mis à jour par Thomas Noël il y a plus de 8 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF