On Wed, Nov 30, 2005 at 05:23:23PM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > I usually check both in my own code but I noticed several places > > where PostgreSQL doesn't, so I kept that style. I'll check both > > if that's preferred. > > I'd say not --- it's more code and it makes a possibly unwarranted > assumption about strtol's behavior.
OTOH, it might be an unwarranted assumption that ERANGE alone indicates error. It's possible that on some system errno's value is meaningless unless strtol() returns one of the documented indicators (LONG_MAX or LONG_MIN). I've seen system calls that behave that way: errno might get set in a non-error situation due to the underlying implementation (e.g., wrappers around socket functions in userland thread implementations), but the programmer has no business looking at errno unless the function returns -1. -- Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match