From: SourceForge.net <no...@so...> - 2007-12-18 16:10:31
|
Bugs item #1853235, was opened at 2007-12-18 11:10 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1853235&group_id=16528 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: PgSQL Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Vincent Vinet (vvinet) Assigned to: Nobody/Anonymous (nobody) Summary: Interval/DateTime Arrays Failure Initial Comment: I get a very odd error when trying to execute queries returning arrays of datetime or interval objects. Here is sample code to reproduce the error: ==================================== import PgSQL conn = PgSQL.connect()#supply your credentials and your server cur = conn.cursor() cur.execute("SELECT ARRAY[now()]") res = cur.fetchall() cur.execute("SELECT ARRAY[now() + '1 hour' - now()]") res = cur.fetchall() ==================================== Now, both of these queries spit out the same error: --------------------------------------------------------------------------- <type 'exceptions.NameError'> Traceback (most recent call last) /usr/lib/python2.5/site-packages/pyPgSQL/<ipython console> in <module>() /usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py in fetchall(self) 3245 # to the list of results. 3246 while self._idx_ < self._rows_: -> 3247 _list.append(self.__fetchOneRow()) 3248 3249 # Fetch the remaining results from the PostgreSQL portal. /usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py in __fetchOneRow(self) 2812 for _i in range(self.res.nfields): 2813 _j.append(_c.typecast(self.description[_i], -> 2814 _r.getvalue(self._idx_, _i))) 2815 2816 self._idx_ = self._idx_ + 1 /usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py in typecast(self, colinfo, value) 888 # Convert string representation of the array into PgArray object. 889 _list = self.parseArray(value) --> 890 return self.handleArray(colinfo, _list) 891 892 if _ftv == PG_INT2: /usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py in handleArray(self, colinfo, lst) 997 lst[_i] = PgInt2(lst[_i]) 998 elif _ftv == DATETIME: --> 999 if _fvt != PG_INTERVAL: 1000 if lst[_i] in ('infinity', '+infinity', '-infinity'): 1001 fake_infinity = '9999-12-13 23:59:59' # fake infinity <type 'exceptions.NameError'>: global name '_fvt' is not defined ... I don't really understant how this error is possible, but it still happens This was tested using python2.5 --version Python 2.5.1 python-pgsql version 2.5.1-2build1 The same code works fine under 2.4.3 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1853235&group_id=16528 |