db/backends/postgresql/operations.py:
{{{
def quote_name(self, name):
if name.startswith('"') and name.endswith('"'):
return name # Quoting once is enough.
# Quote db and schema names separately
parts = name.split('.')
quoted_name = ""
seperator = ''
for part in name.split('.'):
quoted_name += seperator
quoted_name += '"%s"' % part
seperator = '.'
return quoted_name
def unquote_name(self, name):
if name.startswith('"') and name.endswith('"'):
name = name[1:-1]
# Quote only name
parts = name.split('.')
return "%s" % parts[-1]
}}}
db/backends/postgresql/introspection.py:
{{{
def get_table_description(...):
...
cursor.execute("""
SELECT column_name, is_nullable, column_default
FROM information_schema.columns
WHERE table_name = %s""",
[self.connection.ops.unquote_name(table_name)])
...
}}}
Note that the code is crummy at best. Really, to deal with schemas you
should look at both the table_name and the schema_name as needed for the
information_schema.columns. But as long as your table name is unique,
this at least works for now.
--
Ticket URL: <https://code.djangoproject.com/ticket/27908>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Tim Graham):
Is this a duplicate of #22673?
--
Ticket URL: <https://code.djangoproject.com/ticket/27908#comment:1>
* status: new => closed
* resolution: => duplicate
--
Ticket URL: <https://code.djangoproject.com/ticket/27908#comment:2>