Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Russell Keith-Magee authored April 17, 2007
4  django/db/backends/postgresql/base.py
@@ -192,7 +192,7 @@ def get_sql_flush(style, tables, sequences):
192 192
                 sql.append("%s %s %s %s %s %s;" % \
193 193
                     (style.SQL_KEYWORD('ALTER'),
194 194
                     style.SQL_KEYWORD('SEQUENCE'),
195  
-                    style.SQL_FIELD('%s_%s_seq' % (table_name, column_name)),
  195
+                    style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))),
196 196
                     style.SQL_KEYWORD('RESTART'),
197 197
                     style.SQL_KEYWORD('WITH'),
198 198
                     style.SQL_FIELD('1')
@@ -203,7 +203,7 @@ def get_sql_flush(style, tables, sequences):
203 203
                 sql.append("%s %s %s %s %s %s;" % \
204 204
                     (style.SQL_KEYWORD('ALTER'),
205 205
                      style.SQL_KEYWORD('SEQUENCE'),
206  
-                     style.SQL_FIELD('%s_id_seq' % table_name),
  206
+                     style.SQL_FIELD(quote_name('%s_id_seq' % table_name)),
207 207
                      style.SQL_KEYWORD('RESTART'),
208 208
                      style.SQL_KEYWORD('WITH'),
209 209
                      style.SQL_FIELD('1')
4  django/db/backends/postgresql_psycopg2/base.py
@@ -149,7 +149,7 @@ def get_sql_flush(style, tables, sequences):
149 149
                 sql.append("%s %s %s %s %s %s;" % \
150 150
                     (style.SQL_KEYWORD('ALTER'),
151 151
                      style.SQL_KEYWORD('SEQUENCE'),
152  
-                     style.SQL_FIELD('%s_%s_seq' % (table_name, column_name)),
  152
+                     style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))),
153 153
                      style.SQL_KEYWORD('RESTART'),
154 154
                      style.SQL_KEYWORD('WITH'),
155 155
                      style.SQL_FIELD('1')
@@ -160,7 +160,7 @@ def get_sql_flush(style, tables, sequences):
160 160
                 sql.append("%s %s %s %s %s %s;" % \
161 161
                     (style.SQL_KEYWORD('ALTER'),
162 162
                      style.SQL_KEYWORD('SEQUENCE'),
163  
-                     style.SQL_FIELD('%s_id_seq' % table_name),
  163
+                     style.SQL_FIELD(quote_name('%s_id_seq' % table_name)),
164 164
                      style.SQL_KEYWORD('RESTART'),
165 165
                      style.SQL_KEYWORD('WITH'),
166 166
                      style.SQL_FIELD('1')
7  tests/regressiontests/fixtures_regress/models.py
@@ -7,6 +7,13 @@ class Animal(models.Model):
7 7
     def __str__(self):
8 8
         return self.common_name    
9 9
 
  10
+class Plant(models.Model):
  11
+    name = models.CharField(maxlength=150)
  12
+
  13
+    class Meta:
  14
+        # For testing when upper case letter in app name; regression for #4057
  15
+        db_table = "Fixtures_regress_plant"
  16
+
10 17
 __test__ = {'API_TESTS':"""
11 18
 >>> from django.core import management
12 19
 

0 notes on commit c5f0895

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