From: SourceForge.net <no...@so...> - 2005-02-23 05:49:09
|
Bugs item #1068856, was opened at 2004-11-18 12:20 Message generated for change (Settings changed) made by ballie01 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1068856&group_id=16528 Category: PgNumeric Group: None >Status: Pending >Resolution: Fixed Priority: 5 Submitted By: Ken Lalonde (kenlalonde) Assigned to: Nobody/Anonymous (nobody) Summary: PgNumeric(0,10,2)._quote() == 'NULL' Initial Comment: A PgNumeric instance with value zero is incorrectly quoted as 'NULL' instead of '0'. Needless to say, this can have nasty consequences. Fix is trivial: in version 2.4 of PgSQL.py: --- PgSQL.py.old 2004-11-18 12:18:49.334613060 -0500 +++ PgSQL.py 2004-11-18 12:18:59.411482575 -0500 @@ -1664,7 +1664,7 @@ return PgNumeric(-self.__v, self.__p, self.__s) def _quote(self, forArray=0): - if self.__v: + if self.__v is not None: if forArray: return '"%s"' % self.__fmtNumeric() else: ---------------------------------------------------------------------- Comment By: Ken Lalonde (kenlalonde) Date: 2004-11-18 14:11 Message: Logged In: YES user_id=203927 Postscript: same bug affects PgMoney._quote; same fix. While we're here, I see that PgNumeric._quote puts single quotes around the return value. This causes postgres to convert a string to a NUMERIC(S,P) value. Why not omit the quotes and keep it simple? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1068856&group_id=16528 |