diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-05-12 15:21:33 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-05-12 15:21:33 +0000 |
| commit | fd171634818df9c143db42b9fa4c68151e9fd283 (patch) | |
| tree | 9bd0d5b0ee79227ac71c9a45ec4a985cb619ab99 | |
| parent | 6aa5091d58d4f9ad18601b56d39d0de5af094f52 (diff) | |
Fixed #4231 -- Added quoting for sequence names on sequence reset for PostgreSQL. This was causing difficulties if table or application names were capitalized. Thanks for the report, Mark Jarecki.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/backends/postgresql/base.py | 4 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/base.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index dc0fbe3ab9..1ae16feb25 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -223,7 +223,7 @@ def get_sql_sequence_reset(style, model_list): if isinstance(f, models.AutoField): output.append("%s setval('%s', (%s max(%s) %s %s));" % \ (style.SQL_KEYWORD('SELECT'), - style.SQL_FIELD('%s_%s_seq' % (model._meta.db_table, f.column)), + style.SQL_FIELD(quote_name('%s_%s_seq' % (model._meta.db_table, f.column))), style.SQL_KEYWORD('SELECT'), style.SQL_FIELD(quote_name(f.column)), style.SQL_KEYWORD('FROM'), @@ -232,7 +232,7 @@ def get_sql_sequence_reset(style, model_list): for f in model._meta.many_to_many: output.append("%s setval('%s', (%s max(%s) %s %s));" % \ (style.SQL_KEYWORD('SELECT'), - style.SQL_FIELD('%s_id_seq' % f.m2m_db_table()), + style.SQL_FIELD(quote_name('%s_id_seq' % f.m2m_db_table())), style.SQL_KEYWORD('SELECT'), style.SQL_FIELD(quote_name('id')), style.SQL_KEYWORD('FROM'), diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index d6f34f1fe1..9898b121f4 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -180,7 +180,7 @@ def get_sql_sequence_reset(style, model_list): if isinstance(f, models.AutoField): output.append("%s setval('%s', (%s max(%s) %s %s));" % \ (style.SQL_KEYWORD('SELECT'), - style.SQL_FIELD('%s_%s_seq' % (model._meta.db_table, f.column)), + style.SQL_FIELD(quote_name('%s_%s_seq' % (model._meta.db_table, f.column))), style.SQL_KEYWORD('SELECT'), style.SQL_FIELD(quote_name(f.column)), style.SQL_KEYWORD('FROM'), @@ -189,7 +189,7 @@ def get_sql_sequence_reset(style, model_list): for f in model._meta.many_to_many: output.append("%s setval('%s', (%s max(%s) %s %s));" % \ (style.SQL_KEYWORD('SELECT'), - style.SQL_FIELD('%s_id_seq' % f.m2m_db_table()), + style.SQL_FIELD(quote_name('%s_id_seq' % f.m2m_db_table())), style.SQL_KEYWORD('SELECT'), style.SQL_FIELD(quote_name('id')), style.SQL_KEYWORD('FROM'), |
