summaryrefslogtreecommitdiff
path: root/alembic
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-01-12 13:49:16 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-01-12 13:49:16 -0500
commitb2fb21f01e725b88dfd4d6be33e3892c088001ec (patch)
tree35350d2e0638f66f6f16e4723fb1c0d8b42d7665 /alembic
parent948ffd26d4bbf8cbdde42a4618a2efa5bdddde12 (diff)
parenta9c10cb7a21dd87c51c9abd886331175d0c10418 (diff)
downloadalembic-b2fb21f01e725b88dfd4d6be33e3892c088001ec.tar.gz
Merge https://bitbucket.org/dtheodor/alembic/branch/master into pr37
Diffstat (limited to 'alembic')
-rw-r--r--alembic/ddl/postgresql.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/alembic/ddl/postgresql.py b/alembic/ddl/postgresql.py
index 0877c95..ac3a5f4 100644
--- a/alembic/ddl/postgresql.py
+++ b/alembic/ddl/postgresql.py
@@ -4,7 +4,7 @@ from .. import compat
from .base import compiles, alter_table, format_table_name, RenameTable
from .impl import DefaultImpl
from sqlalchemy.dialects.postgresql import INTEGER, BIGINT
-from sqlalchemy import text
+from sqlalchemy import text, Numeric
import logging
log = logging.getLogger(__name__)
@@ -35,7 +35,10 @@ class PostgresqlImpl(DefaultImpl):
if metadata_column.server_default is not None and \
isinstance(metadata_column.server_default.arg,
compat.string_types) and \
- not re.match(r"^'.+'$", rendered_metadata_default):
+ not re.match(r"^'.+'$", rendered_metadata_default) and \
+ not isinstance(inspector_column.type, Numeric):
+ # don't single quote if the column type is float/numeric,
+ # otherwise a comparison such as SELECT 5 = '5.0' will fail
rendered_metadata_default = "'%s'" % rendered_metadata_default
return not self.connection.scalar(