]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- pg uses generic Biginteger now
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 19 Jan 2009 18:59:59 +0000 (18:59 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 19 Jan 2009 18:59:59 +0000 (18:59 +0000)
- fix to _is_excluded() function

lib/sqlalchemy/dialects/postgres/base.py
lib/sqlalchemy/dialects/type_migration_guidelines.txt
test/testlib/testing.py

index 2c5cadff7721f88711b47392c38b2730027dad3c..46765daa1328353f7769a0b0e090910e9657a43a 100644 (file)
@@ -82,9 +82,6 @@ class PGCidr(sqltypes.TypeEngine):
 class PGMacAddr(sqltypes.TypeEngine):
     __visit_name__ = "MACADDR"
 
-class PGBigInteger(sqltypes.Integer):
-    __visit_name__ = "BIGINT"
-
 class PGInterval(sqltypes.TypeEngine):
     __visit_name__ = 'INTERVAL'
 
@@ -156,7 +153,7 @@ colspecs = {
 
 ischema_names = {
     'integer' : sqltypes.INTEGER,
-    'bigint' : PGBigInteger,
+    'bigint' : sqltypes.BigInteger,
     'smallint' : sqltypes.SMALLINT,
     'character varying' : sqltypes.VARCHAR,
     'character' : sqltypes.CHAR,
@@ -278,7 +275,7 @@ class PGDDLCompiler(compiler.DDLCompiler):
             isinstance(column.type, sqltypes.Integer) and \
             not isinstance(column.type, sqltypes.SmallInteger) and \
             (column.default is None or (isinstance(column.default, schema.Sequence) and column.default.optional)):
-            if isinstance(column.type, PGBigInteger):
+            if isinstance(column.type, sqltypes.BigInteger):
                 colspec += " BIGSERIAL"
             else:
                 colspec += " SERIAL"
@@ -379,7 +376,10 @@ class PGTypeCompiler(compiler.GenericTypeCompiler):
     def visit_INTERVAL(self, type_):
         return "INTERVAL"
 
-    def visit_BINARY(self, type_):
+    def visit_binary(self, type_):
+        return self.visit_BYTEA(type_)
+        
+    def visit_BYTEA(self, type_):
         return "BYTEA"
 
     def visit_ARRAY(self, type_):
index f6b40f8370f77e572636f945a42c7cc1ada0241d..7e7e4c5a835bc48c20dafdfcc16b7a64a2d4ebfd 100644 (file)
@@ -9,6 +9,10 @@ Rules for Migrating TypeEngine classes to 0.6
     b. Specifying types that are entirely specific to the database
     in use and have no analogue in the sqlalchemy.types package.
     
+    c. Specifying types where there is an analogue in sqlalchemy.types,
+    but the database in use takes vendor-specific flags for those
+    types.
+    
 2. the TypeEngine classes are *no longer* used for:
 
     a. generating DDL
index d2bccf94db7178ac18c9b1b262e428ec54c6f53b..959c246b84f42e7a66229011952e96c30cabd874 100644 (file)
@@ -273,9 +273,9 @@ def _is_excluded(db, op, spec):
       _is_excluded('yikesdb', 'in', ((0, 3, 'alpha2'), (0, 3, 'alpha3')))
     """
 
-    spec = db_spec(db)
+    vendor_spec = db_spec(db)
 
-    if not spec(config.db):
+    if not vendor_spec(config.db):
         return False
 
     version = _server_version()