]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- The firebird dialect will quote identifiers which begin with an
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Dec 2013 18:40:27 +0000 (13:40 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Dec 2013 18:42:43 +0000 (13:42 -0500)
underscore.  Courtesy Treeve Jelbert. [ticket:2897]

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/firebird/base.py
test/dialect/test_firebird.py

index bd9a44532c9fc452be883158ac637a95abf71673..96e855ed68ef180901091f1630f3c620defe72e6 100644 (file)
 .. changelog::
     :version: 0.8.5
 
+    .. change::
+        :tags: bug, firebird
+        :versions: 0.9.0b2
+        :tickets: 2897
+
+        The firebird dialect will quote identifiers which begin with an
+        underscore.  Courtesy Treeve Jelbert.
+
     .. change::
         :tags: bug, firebird
         :versions: 0.9.0b2
index 734ae8e7b6f295a72008e836744978badc3d93de..d83b4ee301bfb6a0ce9b288b0bb792ff8a544ee8 100644 (file)
@@ -359,6 +359,7 @@ class FBIdentifierPreparer(sql.compiler.IdentifierPreparer):
     """Install Firebird specific reserved words."""
 
     reserved_words = RESERVED_WORDS
+    illegal_initial_characters = compiler.ILLEGAL_INITIAL_CHARACTERS.union(['_'])
 
     def __init__(self, dialect):
         super(FBIdentifierPreparer, self).__init__(dialect, omit_schema=True)
index 0a75cf971a2561b43a33b844cddc6bd33eb43a6b..618819043c5eb352828318410d92e6b5f53b4786 100644 (file)
@@ -352,6 +352,15 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         for type_, args, kw, res in columns:
             self.assert_compile(type_(*args, **kw), res)
 
+    def test_quoting_initial_chars(self):
+        self.assert_compile(
+            column("_somecol"),
+            '"_somecol"'
+        )
+        self.assert_compile(
+            column("$somecol"),
+            '"$somecol"'
+        )
 class TypesTest(fixtures.TestBase):
     __only_on__ = 'firebird'