Re: Data type for oid
"Billy G. Allie" <[email protected]> Tue, 30 Aug 2005 23:24:31 -0400
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
--=-GijrSNMkIWs/6fVzOzOJ Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, 2005-08-30 at 16:44 +0000, Rod MacNeil wrote: > Hi All, > > I'm using pyPgSQL 2.4 postgres 7.4.7 on fedora core 3. > > I have a question about the data type returned in cursor.description when oid is included in the select. > > When I run a query like "select oid, field1,field2 from mytable where field2='x'". > > cursor.description says the oid column is type 'rowid' if there are result rows, but if there are no result rows it says the type is 'blob'. > > Is this a bug? > > Rod MacNeil Not really. It's caused by the fact that an OID can represent a rowid or a postgresql large object (i.e. blob). The only way to tell which one it is is to see if the value of the OID exists as a large object or not. Since there is no result (and hence not value) the lookup can't be made so a type of blob is assumed. -- ____ | Billy G. Allie | Domain....: [email protected] | /| | 7436 Hartwell | MSN.......: [email protected] |-/-|----- | Dearborn, MI 48126| |/ |LLIE | (313) 582-1540 | --=-GijrSNMkIWs/6fVzOzOJ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8"> <META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2"> </HEAD> <BODY> On Tue, 2005-08-30 at 16:44 +0000, Rod MacNeil wrote: <BLOCKQUOTE TYPE=CITE> <PRE> <FONT COLOR="#000000">Hi All,</FONT> <FONT COLOR="#000000">I'm using pyPgSQL 2.4 postgres 7.4.7 on fedora core 3.</FONT> <FONT COLOR="#000000">I have a question about the data type returned in cursor.description when oid is included in the select.</FONT> <FONT COLOR="#000000">When I run a query like "select oid, field1,field2 from mytable where field2='x'".</FONT> <FONT COLOR="#000000">cursor.description says the oid column is type 'rowid' if there are result rows, but if there are no result rows it says the type is 'blob'.</FONT> <FONT COLOR="#000000">Is this a bug?</FONT> <FONT COLOR="#000000">Rod MacNeil</FONT> </PRE> </BLOCKQUOTE> <TABLE BGCOLOR="#ffffff" CELLSPACING="0" CELLPADDING="0" WIDTH="100%"> <TR> <TD> Not really. It's caused by the fact that an OID can represent a rowid or a postgresql large object (i.e. blob). The only way to tell which one it is is to see if the value of the OID exists as a large object or not. Since there is no result (and hence not value) the lookup can't be made so a type of blob is assumed. </TD> </TR> </TABLE> <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%"> <TR> <TD> <PRE> -- ____ | Billy G. Allie | Domain....: [email protected] | /| | 7436 Hartwell | MSN.......: [email protected] |-/-|----- | Dearborn, MI 48126| |/ |LLIE | (313) 582-1540 | </PRE> </TD> </TR> </TABLE> </BODY> </HTML> --=-GijrSNMkIWs/6fVzOzOJ-- ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf