Skip site navigation (1) Skip section navigation (2)

pgsql: Avoid unexpected conversion overflow in planner for distantdate

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid unexpected conversion overflow in planner for distantdate
Date: 2010-12-29 04:02:29
Message-ID: E1PXnF7-0001du-DS@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Avoid unexpected conversion overflow in planner for distant date values.

The "date" type supports a wider range of dates than int64 timestamps do.
However, there is pre-int64-timestamp code in the planner that assumes that
all date values can be converted to timestamp with impunity.  Fortunately,
what we really need out of the conversion is always a double (float8)
value; so even when the date is out of timestamp's range it's possible to
produce a sane answer.  All we need is a code path that doesn't try to
force the result into int64.  Per trouble report from David Rericha.

Back-patch to all supported versions.  Although this is surely a corner
case, there's not much point in advertising a date range wider than
timestamp's if we will choke on such values in unexpected places.

Branch
------
REL8_2_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=1fa37ac25d6aa26443e47f96aafe87c3339ebc18

Modified Files
--------------
src/backend/utils/adt/date.c     |   33 +++++++++++++++++++++++++++++++++
src/backend/utils/adt/selfuncs.c |    3 +--
src/include/utils/date.h         |    2 ++
3 files changed, 36 insertions(+), 2 deletions(-)

pgsql-committers by date

Next:From: Robert HaasDate: 2010-12-29 04:39:32
Subject: Re: pgsql: Ooops, no DATE_IS_NOBEGIN/DATE_IS_NOEND in 8.3 or 8.2 ...
Previous:From: Tom LaneDate: 2010-12-29 02:38:39
Subject: pgsql: Reclassify DEFAULT as a column_constraint item in the CREATETAB

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group