summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/build/changelog/changelog_08.rst8
-rw-r--r--lib/sqlalchemy/dialects/firebird/base.py1
-rw-r--r--test/dialect/test_firebird.py9
3 files changed, 18 insertions, 0 deletions
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst
index 9f2479c2e..2e6bc153c 100644
--- a/doc/build/changelog/changelog_08.rst
+++ b/doc/build/changelog/changelog_08.rst
@@ -14,6 +14,14 @@
.. 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
Fixed bug in Firebird index reflection where the columns within the
index were not sorted correctly; they are now sorted
diff --git a/lib/sqlalchemy/dialects/firebird/base.py b/lib/sqlalchemy/dialects/firebird/base.py
index e6eb27661..777d3ce26 100644
--- a/lib/sqlalchemy/dialects/firebird/base.py
+++ b/lib/sqlalchemy/dialects/firebird/base.py
@@ -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)
diff --git a/test/dialect/test_firebird.py b/test/dialect/test_firebird.py
index 4a71b7d05..222e34b93 100644
--- a/test/dialect/test_firebird.py
+++ b/test/dialect/test_firebird.py
@@ -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'