Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #4057 -- Fixed problem with quoting of sequence names on Postgr…

…es backends. Thanks, Gary Wilson.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c5f08954d50150c1dc121e78d9ab6ef68bb15180 1 parent c64f7f0
@freakboy3742 freakboy3742 authored
View
4 django/db/backends/postgresql/base.py
@@ -192,7 +192,7 @@ def get_sql_flush(style, tables, sequences):
sql.append("%s %s %s %s %s %s;" % \
(style.SQL_KEYWORD('ALTER'),
style.SQL_KEYWORD('SEQUENCE'),
- style.SQL_FIELD('%s_%s_seq' % (table_name, column_name)),
+ style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))),
style.SQL_KEYWORD('RESTART'),
style.SQL_KEYWORD('WITH'),
style.SQL_FIELD('1')
@@ -203,7 +203,7 @@ def get_sql_flush(style, tables, sequences):
sql.append("%s %s %s %s %s %s;" % \
(style.SQL_KEYWORD('ALTER'),
style.SQL_KEYWORD('SEQUENCE'),
- style.SQL_FIELD('%s_id_seq' % table_name),
+ style.SQL_FIELD(quote_name('%s_id_seq' % table_name)),
style.SQL_KEYWORD('RESTART'),
style.SQL_KEYWORD('WITH'),
style.SQL_FIELD('1')
View
4 django/db/backends/postgresql_psycopg2/base.py
@@ -149,7 +149,7 @@ def get_sql_flush(style, tables, sequences):
sql.append("%s %s %s %s %s %s;" % \
(style.SQL_KEYWORD('ALTER'),
style.SQL_KEYWORD('SEQUENCE'),
- style.SQL_FIELD('%s_%s_seq' % (table_name, column_name)),
+ style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))),
style.SQL_KEYWORD('RESTART'),
style.SQL_KEYWORD('WITH'),
style.SQL_FIELD('1')
@@ -160,7 +160,7 @@ def get_sql_flush(style, tables, sequences):
sql.append("%s %s %s %s %s %s;" % \
(style.SQL_KEYWORD('ALTER'),
style.SQL_KEYWORD('SEQUENCE'),
- style.SQL_FIELD('%s_id_seq' % table_name),
+ style.SQL_FIELD(quote_name('%s_id_seq' % table_name)),
style.SQL_KEYWORD('RESTART'),
style.SQL_KEYWORD('WITH'),
style.SQL_FIELD('1')
View
7 tests/regressiontests/fixtures_regress/models.py
@@ -7,6 +7,13 @@ class Animal(models.Model):
def __str__(self):
return self.common_name
+class Plant(models.Model):
+ name = models.CharField(maxlength=150)
+
+ class Meta:
+ # For testing when upper case letter in app name; regression for #4057
+ db_table = "Fixtures_regress_plant"
+
__test__ = {'API_TESTS':"""
>>> from django.core import management

0 comments on commit c5f0895

Please sign in to comment.
Something went wrong with that request. Please try again.