Can I use double quoted names with others SGDBs , PostgreSQL ?
or it is specific for Oracle ...

by the way the patch didint work. Its another problem Is not a metter of
"." namespaced name.
 Its about if I can or not use '"tb_custom_name"'  double quoted string  =
' " " '

if I can use that (' " " ') for any database engine, I believe its a bug
...
and even changed the migration manually, the same error occur when create
an INDEX (at my example) ...

so, the error is at the method that generates the db_name string passed for
the ORM to create tables and constraints.




---------------------------------------------------------------------
Cadu Leite
| Twitter     | Medium Blog | Google +     |
| @cadu_leite <https://twitter.com/cadu_leite> | @cadu_leite
<https://medium.com/@cadu_leite> | +CarlosLeite
<https://plus.google.com/u/0/+CarlosLeite> |

http://people.python.org.br/

On Tue, Nov 28, 2017 at 9:25 AM, Carlos Leite <cadu...@gmail.com> wrote:

> Thanks Simon,
>
> I tryied to find some issue related but found nothing.
>
> The ticket #28792 seems exactly the case ...
>
> I'll take a couple of hours (at work), but I'll try that patch
> and regenarate the migrations.
>
> thanks again.
>
> ---------------------------------------------------------------------
> Cadu Leite
> | Twitter     | Medium Blog | Google +     |
> | @cadu_leite <https://twitter.com/cadu_leite> | @cadu_leite
> <https://medium.com/@cadu_leite> | +CarlosLeite
> <https://plus.google.com/u/0/+CarlosLeite> |
>
> http://people.python.org.br/
>
> On Tue, Nov 28, 2017 at 4:14 AM, Simon Charette <charett...@gmail.com>
> wrote:
>
>> Hey Carlos,
>>
>> I believe the trailing quote truncation issue might be solved in the yet
>> to be released
>> 1.11.8[0][1] version.
>>
>> Could you confirm whether or not it's the case? You'll have to regenerate
>> your migration.
>>
>> Best,
>> Simon
>>
>> [0] https://github.com/django/django/commit/a35ab95ed4eec5c62fa1
>> 9bdc69ecfe0eff3e1fca
>> [1] https://code.djangoproject.com/ticket/28792
>>
>>
>> Le lundi 27 novembre 2017 23:24:59 UTC-5, Carlos Leite a écrit :
>>>
>>> ooops
>>>
>>>
>>> in the migration 0007 the index name seems badly formed
>>>
>>> ```python
>>>    ...
>>>     migrations.AddIndex(
>>>     model_name='publisher',
>>>     index=models.Index(fields=['name'], name='"big_name-w_name_cd0539_idx'),
>>>  # <<<<<<<  there is a " in plus. and its never closed.
>>> ),
>>> ```
>>>
>>> On Tuesday, November 28, 2017 at 2:01:56 AM UTC-2, Carlos Leite wrote:
>>>>
>>>> I was making some introspections on meta attributes from a Model class
>>>> jsut to check what changes when we set some attributes on Meta class
>>>> and etc...
>>>>
>>>>
>>>> TO check the Meta.db_name
>>>> I read the docs and saw that I could use quoted strings as told ..
>>>>
>>>>
>>>> "
>>>> ... o prevent such transformations, use a quoted name as the value for
>>>> db_table:
>>>>
>>>> > db_table = '"name_left_in_lowercase"'
>>>>
>>>>  Such quoted names can also be used with Django’s other supported
>>>> database backends; except for Oracle, however, the quotes have no effect.
>>>> See the Oracle notes
>>>> <https://docs.djangoproject.com/en/1.8/ref/databases/#oracle-notes>
>>>> for more details.
>>>> "
>>>> at https://docs.djangoproject.com/en/1.8/ref/models/options/#db-table
>>>>
>>>>
>>>> Well, when I tried to *migrate* I got the error, during the index
>>>> creation, described below.
>>>> Is it a bug ? or I miss soething ?
>>>> I just tried to set a custom name for a table, with quotes and hyphens
>>>> 8P
>>>>
>>>>
>>>> '"big_name-with-hyphen-left_in_lowercase"'
>>>>
>>>> the error hapends when PostgreSQL tries to create an index and Django
>>>> named with part of the tables name.
>>>>
>>>>
>>>> ### The Model Class
>>>>
>>>>
>>>> class Publisher(models.Model):
>>>> """
>>>> Book's Author - author is a Book's model supplement.
>>>> """
>>>> name = models.CharField(verbose_name='publisher name', max_length=50,
>>>> null=False)
>>>>
>>>>
>>>> class Meta:
>>>> db_table = '"big_name-with-hyphen-left_in_lowercase"'
>>>> get_latest_by = "name"
>>>> ordering = ['name', ]
>>>> verbose_name = 'Publiser'
>>>> verbose_name_plural = 'Publishers'
>>>> indexes = [
>>>> models.Index(fields=['name', ]),
>>>> ]
>>>>
>>>>
>>>>
>>>>
>>>> ### The Migration 0007
>>>>
>>>>
>>>> # -*- coding: utf-8 -*-
>>>> # Generated by Django 1.11 on 2017-11-28 03:15
>>>> from __future__ import unicode_literals
>>>>
>>>>
>>>> from django.db import migrations, models
>>>>
>>>>
>>>>
>>>>
>>>> class Migration(migrations.Migration):
>>>>
>>>>
>>>> dependencies = [
>>>> ('testapp', '0006_auto_20171127_1927'),
>>>> ]
>>>>
>>>>
>>>> operations = [
>>>> migrations.RemoveIndex(
>>>> model_name='publisher',
>>>> name='testapp_pub_name_88e073_idx',
>>>> ),
>>>> migrations.AddIndex(
>>>> model_name='publisher',
>>>> index=models.Index(fields=['name'], name='"big_name-w_name_cd0539_
>>>> idx'),
>>>> ),
>>>> migrations.AlterModelTable(
>>>> name='publisher',
>>>> table='"big_name-with-hyphen-left_in_lowercase"',
>>>> ),
>>>> ]
>>>>
>>>>
>>>>
>>>>
>>>> ### traceback
>>>>
>>>>
>>>> $python manage.py makemigrations
>>>> System check identified some issues:
>>>>
>>>>
>>>> Migrations for 'testapp':
>>>> testproject/testapp/migrations/0007_auto_20171128_0315.py
>>>> - Remove index testapp_pub_name_88e073_idx from publisher
>>>> - Create index "big_name-w_name_cd0539_idx on field(s) name of model
>>>> publisher
>>>> - Rename table for publisher to "big_name-with-hyphen-left_in_
>>>> lowercase"
>>>> (dj_datadictionary) 20171125.Sat01:15:52cadu>/Volu
>>>> mes/p10G/prj/dj_datadictionary_testproject/testproject>
>>>>
>>>>
>>>>
>>>>
>>>> $python manage.py migrate
>>>> System check identified some issues:
>>>>
>>>>
>>>> Operations to perform:
>>>> Apply all migrations: admin, auth, contenttypes, sessions, testapp
>>>> Running migrations:
>>>> Applying testapp.0007_auto_20171128_0315...Traceback (most recent call
>>>> last):
>>>> File "manage.py", line 22, in <module>
>>>> execute_from_command_line(sys.argv)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/core/management/__init__.py", line 363, in
>>>> execute_from_command_line
>>>> utility.execute()
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/core/management/__init__.py", line 355, in execute
>>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/core/management/base.py", line 283, in run_from_argv
>>>> self.execute(*args, **cmd_options)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/core/management/base.py", line 330, in execute
>>>> output = self.handle(*args, **options)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/core/management/commands/migrate.py", line 204, in handle
>>>> fake_initial=fake_initial,
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/migrations/executor.py", line 115, in migrate
>>>> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
>>>> fake_initial=fake_initial)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/migrations/executor.py", line 145, in
>>>> _migrate_all_forwards
>>>> state = self.apply_migration(state, migration, fake=fake,
>>>> fake_initial=fake_initial)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/migrations/executor.py", line 244, in apply_migration
>>>> state = migration.apply(state, schema_editor)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/migrations/migration.py", line 129, in apply
>>>> operation.database_forwards(self.app_label, schema_editor, old_state,
>>>> project_state)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/migrations/operations/models.py", line 785, in
>>>> database_forwards
>>>> schema_editor.add_index(model, self.index)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/backends/base/schema.py", line 330, in add_index
>>>> self.execute(index.create_sql(model, self))
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/backends/base/schema.py", line 119, in execute
>>>> cursor.execute(sql, params)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/backends/utils.py", line 80, in execute
>>>> return super(CursorDebugWrapper, self).execute(sql, params)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/backends/utils.py", line 65, in execute
>>>> return self.cursor.execute(sql, params)
>>>> File 
>>>> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/utils.py",
>>>> line 94, in __exit__
>>>> six.reraise(dj_exc_type, dj_exc_value, traceback)
>>>> File "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packa
>>>> ges/django/db/backends/utils.py", line 65, in execute
>>>> return self.cursor.execute(sql, params)
>>>> django.db.utils.ProgrammingError: zero-length delimited identifier at
>>>> or near """"
>>>> LINE 1: CREATE INDEX ""big_name-w_name_cd0539_idx" ON "testapp_publi...
>>>> ^
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/059d8feb-45dd-4f30-aa7f-cfc3a71659d5%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/059d8feb-45dd-4f30-aa7f-cfc3a71659d5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEM6-Q%2BwVcHUk_k%2BE5tsr%3Dfb6K3D7uDwD-m3MN-%3Dfc4rYnfGEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to