#9116: different caps in application name producing error
------------------------------------------------------+---------------------
Reporter: Maxim Syabro <[EMAIL PROTECTED]> | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.0
Resolution: | Keywords:
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------------------------+---------------------
Old description:
> I have an application with name localModels and lower_case_table_names
> mysql variable=1, which said to MySQL automatically convert table name to
> lowercase.
> Let's look in djnago.core.management.commnads.syncdb.py, line 67:
> {{{
> #!python
> if connection.introspection.table_name_converter(model._meta.db_table) in
> tables:
> continue
> }}}
> connection.introspection.table_name_converter(model._meta.db_table) =
> 'localModels_tablename'
> in tables we have
> (..., 'localmodels_tablename', ...)
> so here your condition doesn't work, beacuse
> 'localModels_tablename'!='localmodels_tablename'.
> And we have an exception in manage.py syncdb:
> _mysql_exceptions.OperationalError: (1050, "Table 'localmodels_tablename'
> already exists")
>
> So I see at least 2 ways:
> 1. Generate SQL 'CREATE TABLE `tablename` IF NOT EXIST'
> 2. Check MySQL's lower_case_table_names variable and change condition on
> line 67.
New description:
I have an application with name `localModels` and `lower_case_table_names`
mysql variable=1, which said to MySQL automatically convert table name to
lowercase.
Let's look in `djnago.core.management.commnads.syncdb.py`, line 67:
{{{
#!python
if connection.introspection.table_name_converter(model._meta.db_table) in
tables:
continue
}}}
`connection.introspection.table_name_converter(model._meta.db_table) =
'localModels_tablename'`
in tables we have
`(..., 'localmodels_tablename', ...)`
so here your condition doesn't work, beacuse
`'localModels_tablename'!='localmodels_tablename'`.
And we have an exception in `manage.py syncdb`:
{{{
_mysql_exceptions.OperationalError: (1050, "Table 'localmodels_tablename'
already exists")
}}}
So I see at least 2 ways:
1. Generate SQL {{{'CREATE TABLE `tablename` IF NOT EXIST'}}}
2. Check MySQL's `lower_case_table_names` variable and change condition
on line 67.
Comment (by ramiro):
(reformatted description)
--
Ticket URL: <http://code.djangoproject.com/ticket/9116#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---