]> 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:18:59 +0000 (11:18 -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
doc/build/changelog/changelog_09.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 d6af87132ea8f26ee771f6f9bb7553b747d694b2..4e545418048f8c17eef24a84794da1fa8b43502a 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 78c7e0c9ab022bb81ad62c8d75cedb6e150f377b..02a5c1d81a1c2ee367b46dd9b61139e1cf143695 100644 (file)
@@ -6,6 +6,13 @@
 .. changelog::
     :version: 0.9.0
 
+    .. 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.8.3, 0.7.11.
+
     .. change::
         :tags: bug, orm
         :tickets: 2778
index c894357b580bc5ac4874776f71173514b4af8167..6796d7edb19ac96f307871d51975a680be4fe450 100644 (file)
@@ -291,7 +291,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 717f0f7970a64d7b49a22fc7972ee4ac38433272..c92f1ac8011d6a7052158b1550cfa15f392f7ed7 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'])
+