]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from a
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 17 Jul 2013 15:18:59 +0000 (11:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 17 Jul 2013 15:19:50 +0000 (11:19 -0400)
:class:`.Column` object would not be propagated.  Also in 0.8.3, 0.7.11.
[ticket:2784]

doc/build/changelog/changelog_07.rst
doc/build/changelog/changelog_08.rst
lib/sqlalchemy/sql/util.py
test/sql/test_quote.py

index c650e769f5657718f62018d8b0b4cd12a4950517..99702a2f0c90397d05d60a1ce4283360489524bd 100644 (file)
@@ -6,6 +6,13 @@
 .. changelog::
     :version: 0.7.11
 
+    .. change::
+        :tags: bug, sql
+        :tickets: 2784
+
+        Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from a
+        :class:`.Column` object would not be propagated.
+
     .. change::
       :tags: bug, orm
       :tickets: 2699
index ded97c8d844b23a68fc8458c56b63f037f707e74..f266b2e6effffe37e3cf9934e6d0a3a8a225ef70 100644 (file)
@@ -6,6 +6,13 @@
 .. changelog::
     :version: 0.8.3
 
+    .. change::
+        :tags: bug, sql
+        :tickets: 2784
+
+        Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from a
+        :class:`.Column` object would not be propagated.  Also in 0.7.11.
+
     .. change::
         :tags: bug, orm
         :tickets: 2778
index 4aa2d749686465f580b29fa324de6be7b1836b66..61730f1f02b9621fec49ee4997a33c45dab5f5da 100644 (file)
@@ -276,7 +276,9 @@ def expression_as_ddl(clause):
             return expression.literal_column(_quote_ddl_expr(element.value))
         elif isinstance(element, expression.ColumnClause) and \
                 element.table is not None:
-            return expression.column(element.name)
+            col = expression.column(element.name)
+            col.quote = element.quote
+            return col
         else:
             return None
 
index 8b14d23a98d355c41b6d4a0aa5fbb87c91326aca..c2efd8f9d727f087f38b63de7d41292273caeb27 100644 (file)
@@ -542,6 +542,28 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL):
                 'Foo.T1'
         )
 
+    def test_quote_flag_propagate_check_constraint(self):
+        m = MetaData()
+        t = Table('t', m, Column('x', Integer, quote=True))
+        CheckConstraint(t.c.x > 5)
+        self.assert_compile(
+            schema.CreateTable(t),
+            "CREATE TABLE t ("
+            '"x" INTEGER, '
+            'CHECK ("x" > 5)'
+            ")"
+        )
+
+    def test_quote_flag_propagate_index(self):
+        m = MetaData()
+        t = Table('t', m, Column('x', Integer, quote=True))
+        idx = Index("foo", t.c.x)
+        self.assert_compile(
+            schema.CreateIndex(idx),
+            'CREATE INDEX foo ON t ("x")'
+        )
+
+
 
 class PreparerTest(fixtures.TestBase):
     """Test the db-agnostic quoting services of IdentifierPreparer."""
@@ -596,3 +618,4 @@ class PreparerTest(fixtures.TestBase):
         a_eq(unformat('foo.`bar`'), ['foo', 'bar'])
         a_eq(unformat('`foo`.bar'), ['foo', 'bar'])
         a_eq(unformat('`foo`.`b``a``r`.`baz`'), ['foo', 'b`a`r', 'baz'])
+