]> 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:40:27 +0000 (13:40 -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 9f2479c2e80b6686f727513893d3c76baae202e6..2e6bc153cb0a974b2d79fe55c7a32d519a320291 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 e6eb276613631745bcfeaaf6b170d1d3386db8a6..777d3ce26664491cf36fd7f26d1d301314c312ba 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 4a71b7d050817b0ec53eb8dc0771d69c3e81d443..222e34b939eadc0503686de10312310ad810ee96 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'