Django

Code

Ticket #5578 (new)

Opened 8 months ago

Last modified 6 months ago

Can't import fixtures generated using mysql into postgresql

Reported by: django@catchall.getdown.org Assigned to: nobody
Component: Database wrapper Version: SVN
Keywords: postgresql mysql case sensitive sensitivity fixture load Cc: mir@noris.de
Triage Stage: Accepted Has patch: 0
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description (Last modified by ubernostrum)

Fixtures generated using an app running against mysql can't be imported by that same app if switched to run against postgresql. This appears to have to do with different handling of mixed case table/column names in django's drivers for the two databases.

Here's the error I get. The same error occurs regardless of fixture format. Note the case difference between spackle1_projecttemplate_subjectareas (from the exception) and spackle1_projecttemplate_subjectAreas (from the sql):

Loading 'spackle1/fixtures/spackle1' fixtures...
Installing xml fixture 'spackle1/fixtures/spackle1' from absolute path.
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/__init__.py", line 264, in execute_manager
    utility.execute()
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 215, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 70, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 84, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 119, in handle
    cursor.execute(line)
  File "/usr/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.5/site-packages/django/db/backends/postgresql/base.py", line 47, in execute
    return self.cursor.execute(smart_str(sql, self.charset), self.format_params(params))
psycopg.ProgrammingError: ERROR:  relation "spackle1_projecttemplate_subjectareas" does not exist

SELECT setval('"spackle1_projecttemplate_subjectAreas_id_seq"', coalesce(max("id"), 1), max("id") IS NOT null) FROM spackle1_projecttemplate_subjectAreas;

Attachments

Change History

09/23/07 04:09:06 changed by ubernostrum

  • needs_better_patch changed.
  • description changed.
  • needs_tests changed.
  • needs_docs changed.

(cleaning up formatting in description)

09/24/07 15:17:49 changed by mir

  • cc set to mir@noris.de.

12/01/07 20:41:55 changed by Simon G <dev@simon.net.nz>

  • stage changed from Unreviewed to Accepted.

Add/Change #5578 (Can't import fixtures generated using mysql into postgresql)




Change Properties
Action