#3954 closed (fixed)
[patch] Fixtures for postgresql and problems with colors.
Reported by: | anonymous | Owned by: | Jacob |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
Severity: | Keywords: | fixtures, loaddata, sequences, postgresql | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have this fixture (yaml format):
- model: sites.Site pk: 1 fields: domain: localhost:8000 name: localhost:8000
I try to load this fixture:
> ./manage.py loaddata sites Loading 'sites' fixtures... Installing yaml fixture 'sites' from ... Installed 1 object(s) from 1 fixture(s) Traceback (most recent call last): File "./manage.py", line 12, in <module> execute_manager(settings) File "/usr/local/lib/python2.5/site-packages/django/core/management.py", line 1668, in execute_manager execute_from_command_line(action_mapping, argv) File "/usr/local/lib/python2.5/site-packages/django/core/management.py", line 1582, in execute_from_command_line action_mapping[action](args[1:], int(options.verbosity)) File "/usr/local/lib/python2.5/site-packages/django/core/management.py", line 1412, in load_data cursor.execute(line) File "/usr/local/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 " " LINE 1: SELECT setval('django_site_id_seq', ( [3... ^
If I use patch show-sql.diff (SELECT is with colors):
> ./manage.py loaddata sites Loading 'sites' fixtures... Installing yaml fixture 'sites' from ... Installed 1 object(s) from 1 fixture(s) SELECT setval('django_site_id_seq', (SELECT max("id") FROM "django_site")); '\x1b[33mSELECT\x1b[0m setval(\'\x1b[32;1mdjango_site_id_seq\x1b[0m\', (\x1b[33mSELECT\x1b[0m max(\x1b[32;1m"id"\x1b[0m) \x1b[33mFROM\x1b[0m \x1b[1m"django_site"\x1b[0m));' Traceback (most recent call last): ...
If I use patch no-colors-for-sql.diff, loading is ok.
I use postgresql 8.2.3, psycopg 2.0.5 and python 2.5.1 rc1 (Ubuntu 6.04 Feisty Fawn), but I also tried psycopg 1.1.21 and/or python 2.4.4 (four unsuccessful attempts and two successful attempts - patch is only for psycopg2).
Attachments (4)
Change History (13)
by , 18 years ago
Attachment: | show-sql.diff added |
---|
by , 18 years ago
Attachment: | no-colors-for-sql.diff added |
---|
comment:1 by , 18 years ago
by , 18 years ago
Attachment: | no_colors_for_sql_pg1.diff added |
---|
comment:2 by , 18 years ago
Patch needs improvement: | set |
---|
Marked #4012 as a duplication of this.
no_colors_for_sql_pg1.diff is a patch for the psycopg 1.x layer.
by , 18 years ago
Attachment: | loaddata_nocolors.diff added |
---|
Fix for missing disable_termcolors() in load_data
comment:3 by , 18 years ago
Patch needs improvement: | unset |
---|
The problem appears to be caused by a missing call to disable_termcolors() in load_data(). Fixed in patch: loaddata_nocolors.diff.
comment:4 by , 18 years ago
Has patch: | set |
---|
comment:5 by , 18 years ago
Summary: | Fixtures for postgresql and problems with colors. → [patch] Fixtures for postgresql and problems with colors. |
---|
comment:6 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Hope it's OK to set this as Accepted, since it seems to be a clear-cut bug (raised by another user). Don't feel it needs any documentation or unit test.
comment:7 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
follow-up: 9 comment:8 by , 18 years ago
Errr... that's "Vinay", not "Vijay". Thanks for committing the fix!
comment:9 by , 18 years ago
Replying to Vinay Sajip <vinay_sajip@yahoo.co.uk>:
Errr... that's "Vinay", not "Vijay". Thanks for committing the fix!
Humble apologies. For what it's worth, I got your name right in the AUTHORS file :-)
Maybe this part of django can be relevant (django.core.management.py, 49-51):
Attempt with pipe (and without patches):