Re: Tightening binary receive functions

James William Pye <lists@jwp.name>

From: James William Pye <lists@jwp.name>
To: Bruce Momjian <bruce@momjian.us>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2010-02-17T03:55:11Z
Lists: pgsql-hackers
On Nov 10, 2009, at 9:54 AM, Bruce Momjian wrote:

> FYI, Heikki has fixed this bug and the fix will appear in Postgres 8.5.

>> Heikki> Oops, you're right. The check is indeed confusing julian day
>> Heikki> numbers, with epoch at 23th of Nov 4714 BC, with
>> Heikki> postgres-reckoning day numbers, with epoch at 1th of Jan
>> Heikki> 2000. Thanks, will fix.



Need a special case for the infinities as well?


postgres=# create table foo (d date);
CREATE TABLE
postgres=# INSERT INTO foo VALUES ('infinity');
INSERT 0 1
postgres=# COPY foo TO '/Users/jwp/foo.copy' WITH BINARY;
COPY 1
postgres=# COPY foo FROM '/Users/jwp/foo.copy' WITH BINARY;
ERROR:  date out of range
CONTEXT:  COPY foo, line 1, column d
postgres=# DELETE FROM foo;
DELETE 1
postgres=# INSERT INTO foo VALUES ('-infinity');
INSERT 0 1
postgres=# COPY foo TO '/Users/jwp/foo.copy' WITH BINARY;
COPY 1
postgres=# COPY foo FROM '/Users/jwp/foo.copy' WITH BINARY;
ERROR:  date out of range
CONTEXT:  COPY foo, line 1, column d

postgres=# SELECT version();
                                                                      version                                                                     
---------------------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 8.5devel on i386-apple-darwin10.2.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1), 64-bit
(1 row)