Incorrect type returned for "time" columns?
Andrew McNamara <[email protected]> Fri, 20 May 2005 11:51:34 +1000
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
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>]
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
-------------------------------------------------------
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