﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4012	"""ProgrammingError: syntax error"" when loading (JSON) serialized data"	eduardo.padoan@…	Jacob	"I'm using rev. 4993. My model is:
(testproj.testapp)

{{{
from django.db import models

class TestModel(models.Model):
    name = models.CharField(maxlength=10)
}}}

Then:

{{{
$ ./manage.py shell
Python 2.5.1c1 (release25-maint, Apr  6 2007, 22:02:36)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
(InteractiveConsole)
>>> from testproj.testapp. models import TestModel
>>> test_obj = TestModel(name=""Foo"")
>>> test_obj.save()
>>>
}}}
...And:
{{{
$ ./manage.py dumpdata testapp
[{""pk"": ""1"", ""model"": ""testapp.testmodel"", ""fields"": {""name"": ""Foo""}}]
}}}

OK it is there. Lets get it back:
{{{
$ ./manage.py dumpdata testapp > test.json
$ ./manage.py loaddata test.json
Loading 'test' fixtures...
Installing json fixture 'test' from absolute path.
Installed 1 object(s) from 1 fixture(s)
Traceback (most recent call last):
  File ""./manage.py"", line 11, in <module>
    execute_manager(settings)
  File ""/usr/lib/python2.5/site-packages/django/core/management.py"", line 1669, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File ""/usr/lib/python2.5/site-packages/django/core/management.py"", line 1583, in execute_from_command_line
    action_mapping[action](args[1:], int(options.verbosity))
  File ""/usr/lib/python2.5/site-packages/django/core/management.py"", line 1413, in load_data
    cursor.execute(line)
  File ""/usr/lib/python2.5/site-packages/django/db/backends/util.py"", line 12, in execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: syntax error at or near ""
}}}

On ""screen -U"" (unicode), the error message ends on the '''""'''. I have to type Enter to get my shell back.
Without screen:
{{{
[...]
psycopg2.ProgrammingError: syntax error at or near ""
INE 1: SELECT setval('testapp_testmodel_id_seq'...
        ^

}}}

"		closed	Core (Serialization)	dev		duplicate	JSON		Unreviewed	0	0	0	0	0	0
