Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#6781 closed (worksforme)

ProgrammingError with edit_inline set

Reported by: imbaczek@… Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Environment:

Request Method: POST
Request URL: http://debian:8000/admin/businessPartner/entry/33/
Django Version: 0.97-pre-SVN-7249
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
# snip my apps
# ...
 'registration',
 'template_utils',
 'nesh.thumbnail']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "/home/imbaczek/usr/django-trunk/django/core/handlers/base.py" in get_response
  82.                 response = callback(request, *callback_args, **callback_kwargs)
File "/home/imbaczek/usr/django-trunk/django/contrib/admin/views/decorators.py" in _checklogin
  62.             return view_func(request, *args, **kwargs)
File "/home/imbaczek/usr/django-trunk/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/home/imbaczek/usr/django-trunk/django/contrib/admin/views/main.py" in change_stage
  338.             new_object = manipulator.save(new_data)
File "/home/imbaczek/usr/django-trunk/django/db/models/manipulators.py" in save
  201.                         new_rel_obj.save()
File "/home/imbaczek/usr/django-trunk/django/db/models/base.py" in save
  233.                 self._meta.pk.get_db_prep_lookup('exact', pk_val))
File "/home/imbaczek/usr/django-trunk/django/db/backends/util.py" in execute
  18.             return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /admin/businessPartner/entry/33/
Exception Value: operator does not exist: integer = text[]
LINE 1: SELECT 1 FROM "table" WHERE "id"=ARRAY['34...
                                                          ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

I added some print statements near the offending cursor.execute and for get_db_prep_lookup (note: expect line mismatch in traceback), here are the results:

exact pk= [u'33']
exact pk= [[u'34']]
sql=SELECT 1 FROM "table" WHERE "id"=%s
params=[[u'34']]

clearly the found pk is being put on a list that breaks stuff. The models don't use any custom fields. The SELECT statement refers to the first of inline-edited objects.

SVN r7249.

Attachments (1)

edit_inline_too_many_lists.patch (1.6 KB) - added by imbaczek@… 6 years ago.

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by imbaczek@…

comment:1 Changed 6 years ago by imbaczek@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I think I managed to fix it myself. Please check.

comment:2 Changed 6 years ago by anonymous

  • Has patch set
  • Summary changed from admin: ProgrammingError with edit_inline set to [patch] admin: ProgrammingError with edit_inline set

comment:3 Changed 6 years ago by mtredinnick

  • Summary changed from [patch] admin: ProgrammingError with edit_inline set to ProgrammingError with edit_inline set

It's impossible to evaluate this fix without having some way to repeat the problem. Since edit_inline isn't completely broken, there must be something about your particular case that is special. Please construct a very short example pair of models and describe how to replicate the problem.

comment:4 Changed 6 years ago by anonymous

  • Resolution set to worksforme
  • Status changed from new to closed
  • Version changed from SVN to newforms-admin

Closing this ticket since its deprecated with newforms-admin. If it doesn't work there as well, feel free to open a new one.

comment:5 Changed 6 years ago by Honza_Kral

sorry, didn't mean to do that as Anonymous Coward

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.