On Aug 31, 2009, at 1:12 AM, Heikki Linnakangas wrote:
...
Is the new date_recv() constraint actually correct?
[looking at the "result < 0" part, at least]
src/backend/utils/adt/date.c
...
+ /* Limit to the same range that date_in() accepts. */
+ if (result < 0 || result > JULIAN_MAX)
+ ereport(ERROR,
+ (errcode
(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
+ errmsg("date out of range")));
+
+ PG_RETURN_DATEADT(result);
}
postgres=# SELECT date_send('500-01-01'::date);
date_send
------------
\xfff7a3e9
(1 row)
...
>>> struct.unpack("!l", b'\xff\xf7\xa3\xe9')
(-547863,)
Perhaps 'result' needs to be adjusted by the postgres epoch for the
comparison?
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers