From: Mike Bayer Date: Fri, 27 Dec 2013 18:40:27 +0000 (-0500) Subject: - The firebird dialect will quote identifiers which begin with an X-Git-Tag: rel_0_9_0~11^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92a1426c06c49f5b3db8cc41afe0ed92e8631972;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - The firebird dialect will quote identifiers which begin with an underscore. Courtesy Treeve Jelbert. [ticket:2897] --- diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 9f2479c2e8..2e6bc153cb 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -11,6 +11,14 @@ .. 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 diff --git a/lib/sqlalchemy/dialects/firebird/base.py b/lib/sqlalchemy/dialects/firebird/base.py index e6eb276613..777d3ce266 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 4a71b7d050..222e34b939 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'