summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-06-25 13:11:06 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-06-25 13:11:06 -0400
commit3eab7982537426d4dc1c467df1371dea3b0a0a4e (patch)
tree87e5c85749a8bc36ae900046bdf6f45c99c47901 /lib
parent7dcfc49b349377b86f4d7d0e0c804f4d19282d15 (diff)
downloadsqlalchemy-3eab7982537426d4dc1c467df1371dea3b0a0a4e.tar.gz
- Won't generate "CREATE TYPE" / "DROP TYPE" if
using types.Enum on a PG version prior to 8.3 - the supports_native_enum flag is fully honored. [ticket:1836]
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 8275aa1e7..1a7f670a1 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -260,10 +260,16 @@ PGArray = ARRAY
class ENUM(sqltypes.Enum):
def create(self, bind=None, checkfirst=True):
+ if not bind.dialect.supports_native_enum:
+ return
+
if not checkfirst or not bind.dialect.has_type(bind, self.name, schema=self.schema):
bind.execute(CreateEnumType(self))
def drop(self, bind=None, checkfirst=True):
+ if not bind.dialect.supports_native_enum:
+ return
+
if not checkfirst or bind.dialect.has_type(bind, self.name, schema=self.schema):
bind.execute(DropEnumType(self))