From 42bbb7163adaaa1513c7c4f5212675632be8e030 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 20 Jun 2014 17:58:06 -0400 Subject: - Added a new type :class:`.postgresql.OID` to the Postgresql dialect. While "oid" is generally a private type within PG that is not exposed in modern versions, there are some PG use cases such as large object support where these types might be exposed, as well as within some user-reported schema reflection use cases. fixes #3002 --- lib/sqlalchemy/dialects/postgresql/base.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 42ec19c20..35f335252 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -409,6 +409,15 @@ class MACADDR(sqltypes.TypeEngine): PGMacAddr = MACADDR +class OID(sqltypes.TypeEngine): + """Provide the Postgresql OID type. + + .. versionadded:: 0.9.5 + + """ + __visit_name__ = "OID" + + class TIMESTAMP(sqltypes.TIMESTAMP): def __init__(self, timezone=False, precision=None): super(TIMESTAMP, self).__init__(timezone=timezone) @@ -1080,6 +1089,7 @@ ischema_names = { 'bit': BIT, 'bit varying': BIT, 'macaddr': MACADDR, + 'oid': OID, 'double precision': DOUBLE_PRECISION, 'timestamp': TIMESTAMP, 'timestamp with time zone': TIMESTAMP, @@ -1353,6 +1363,9 @@ class PGTypeCompiler(compiler.GenericTypeCompiler): def visit_MACADDR(self, type_): return "MACADDR" + def visit_OID(self, type_): + return "OID" + def visit_FLOAT(self, type_): if not type_.precision: return "FLOAT" -- cgit v1.2.1