aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2009-09-04 11:20:23 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2009-09-04 11:20:23 +0000
commit7be39bb0be87a2fe6ea64c9d48130b78412968a8 (patch)
tree6e6e1c6d01540cf47a6ad529f5b61f317134bb15 /src/backend/utils/adt/timestamp.c
parent237859e4fb13851ffd2f45a6706a0540ca014b5d (diff)
downloadpostgresql-7be39bb0be87a2fe6ea64c9d48130b78412968a8.tar.gz
postgresql-7be39bb0be87a2fe6ea64c9d48130b78412968a8.zip
Tigthen binary receive functions so that they reject values that the text
input functions don't accept either. While the backend can handle such values fine, they can cause trouble in clients and in pg_dump/restore. This is followup to the original issue on time datatype reported by Andrew McNamara a while ago. Like that one, none of these seem worth back-patching.
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 9c020f2d10a..a0a61a726af 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.202 2009/07/06 20:29:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.203 2009/09/04 11:20:22 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -253,6 +253,11 @@ timestamp_recv(PG_FUNCTION_ARGS)
timestamp = (Timestamp) pq_getmsgint64(buf);
#else
timestamp = (Timestamp) pq_getmsgfloat8(buf);
+
+ if (isnan(timestamp))
+ ereport(ERROR,
+ (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
+ errmsg("timestamp cannot be NaN")));
#endif
/* rangecheck: see if timestamp_out would like it */