From: Lele Gaifax Date: Thu, 28 Jan 2010 10:56:33 +0000 (+0000) Subject: Fix #1663 on 0.5.x: the whitespace after DEFAULT may start with a newline X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac96e743e3615aa42220b7084ceb0a68149a5b04;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix #1663 on 0.5.x: the whitespace after DEFAULT may start with a newline --- diff --git a/CHANGES b/CHANGES index 0068cc20b4..98063d9c1b 100644 --- a/CHANGES +++ b/CHANGES @@ -8,7 +8,7 @@ CHANGES ===== - firebird - Fix reflection of default values with spurious spaces - (backport of r6257). [ticket:1582] + (backport of r6257 and r6699). [ticket:1582 and ticket:1663] 0.5.8 ===== diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py index 32dc211b6d..200c6c3b0c 100644 --- a/lib/sqlalchemy/databases/firebird.py +++ b/lib/sqlalchemy/databases/firebird.py @@ -498,9 +498,10 @@ class FBDialect(default.DefaultDialect): # does it have a default value? if row['fdefault'] is not None: # the value comes down as "DEFAULT 'value'": there may be - # more than one space around the "DEFAULT" keyword + # more than one whitespace around the "DEFAULT" keyword + # (see also http://tracker.firebirdsql.org/browse/CORE-356) defexpr = row['fdefault'].lstrip() - assert defexpr.startswith('DEFAULT '), "Unrecognized default value: %s" % defexpr + assert defexpr[:8].rstrip()=='DEFAULT', "Unrecognized default value: %s" % defexpr defvalue = defexpr[8:].strip() if defvalue != 'NULL': args.append(schema.DefaultClause(sql.text(defvalue)))