I’m trying to delete a table hosted in heroku. Because it is in the shared database I can’t connect to postgres directly to perform sentence. I execute delete through django shell. Issue is that table name is in uppercase and, for unknow reason, django try to delete it in lower cases:
>>> sql = '''drop table campings_horesEntrega cascade; <---see uppercases
... drop table campings_horesRecollida; '''
>>>
>>> from django.db import connections, transaction
>>> cursor = connections['default'].cursor()
>>> cursor.execute(sql)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
return self.cursor.execute(query, args)
DatabaseError: table "campings_horesentrega" does not exist <--- see lowercases
someone has a workaround to my issue?
thanks a lot.
You need to wrap your table names in quotes if you want postgres to respect case.