From: | James Pye <lists(at)jwp(dot)name> |
---|---|
To: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Tightening binary receive functions |
Date: | 2009-10-24 16:22:34 |
Message-ID: | 141ACF36-5214-4A76-9488-13EFDE7BE99C@jwp.name |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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?
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2009-10-24 16:32:31 | Re: Parsing config files in a directory |
Previous Message | Simon Riggs | 2009-10-24 16:20:25 | Re: Parsing config files in a directory |