﻿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
3954	[patch] Fixtures for postgresql and problems with colors.	anonymous	Jacob	"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)."		closed	Core (Serialization)	dev		fixed	fixtures, loaddata, sequences, postgresql		Accepted	1	0	0	0	0	0
