Re: Incorrect type returned for "time" columns?
"Billy G. Allie" <[email protected]> Fri, 20 May 2005 21:32:19 -0400
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
--=-aIjK6w6nx7zjEWYmvGSt
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2005-05-20 at 11:51 +1000, Andrew McNamara wrote:
> In the current CVS HEAD, columns of type "time" are being returned as
> DateTime objects, rather than Time objects (DateTimeDelta):
>
> Welcome to psql 7.4.7, the PostgreSQL interactive terminal.
>
> test=# create table x ( y time, z time with time zone);
> CREATE TABLE
> test=# insert into x values (now(), now());
> INSERT 10352072 1
> test=# select * from x;
> y | z
> -----------------+--------------------
> 11:46:25.602349 | 11:46:25.602349+10
>
> Python 2.4.1 (#2, May 5 2005, 11:32:06)
> [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
> >>> from pyPgSQL import PgSQL
> >>> db=PgSQL.connect(database="test")
> >>> c=db.cursor()
> >>> c.execute('select * from x')
> >>> c.fetchone()
> [<DateTime object for '2005-05-20 21:46:25.60' at b7e7b950>, <DateTime object for '2005-05-20 11:46:25.60' at b7e88db0>]
>
The issue has been fixed in CVS HEAD code base.
--=-aIjK6w6nx7zjEWYmvGSt
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 Fri, 2005-05-20 at 11:51 +1000, Andrew McNamara wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">In the current CVS HEAD, columns of type "time" are being returned as</FONT>
<FONT COLOR="#000000">DateTime objects, rather than Time objects (DateTimeDelta):</FONT>
<FONT COLOR="#000000"> Welcome to psql 7.4.7, the PostgreSQL interactive terminal.</FONT>
<FONT COLOR="#000000"> test=# create table x ( y time, z time with time zone);</FONT>
<FONT COLOR="#000000"> CREATE TABLE</FONT>
<FONT COLOR="#000000"> test=# insert into x values (now(), now());</FONT>
<FONT COLOR="#000000"> INSERT 10352072 1</FONT>
<FONT COLOR="#000000"> test=# select * from x;</FONT>
<FONT COLOR="#000000"> y | z </FONT>
<FONT COLOR="#000000"> -----------------+--------------------</FONT>
<FONT COLOR="#000000"> 11:46:25.602349 | 11:46:25.602349+10</FONT>
<FONT COLOR="#000000"> Python 2.4.1 (#2, May 5 2005, 11:32:06) </FONT>
<FONT COLOR="#000000"> [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2</FONT>
<FONT COLOR="#000000"> >>> from pyPgSQL import PgSQL</FONT>
<FONT COLOR="#000000"> >>> db=PgSQL.connect(database="test")</FONT>
<FONT COLOR="#000000"> >>> c=db.cursor()</FONT>
<FONT COLOR="#000000"> >>> c.execute('select * from x')</FONT>
<FONT COLOR="#000000"> >>> c.fetchone()</FONT>
<FONT COLOR="#000000"> [<DateTime object for '2005-05-20 21:46:25.60' at b7e7b950>, <DateTime object for '2005-05-20 11:46:25.60' at b7e88db0>]</FONT>
</PRE>
</BLOCKQUOTE>
The issue has been fixed in CVS HEAD code base.<BR>
<BR>
</BODY>
</HTML>
--=-aIjK6w6nx7zjEWYmvGSt--
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click