Re: Tightening binary receive functions - Mailing list pgsql-hackers

From James Pye
Subject Re: Tightening binary receive functions
Date
Msg-id 141ACF36-5214-4A76-9488-13EFDE7BE99C@jwp.name
Whole thread Raw
In response to Tightening binary receive functions  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Tightening binary receive functions
List 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?


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Parsing config files in a directory
Next
From: Magnus Hagander
Date:
Subject: Re: Parsing config files in a directory