From db05f4a7eb6c80c67c25ca9d28be825b99ed3553 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 20 Jul 2005 16:42:32 +0000 Subject: Add 'day' field to INTERVAL so 1 day interval can be distinguished from 24 hours. This is very helpful for daylight savings time: select '2005-05-03 00:00:00 EST'::timestamp with time zone + '24 hours'; ?column? ---------------------- 2005-05-04 01:00:00-04 select '2005-05-03 00:00:00 EST'::timestamp with time zone + '1 day'; ?column? ---------------------- 2005-05-04 01:00:00-04 Michael Glaesemann --- src/backend/commands/variable.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/backend/commands/variable.c') diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 7df2a92a6c6..dec91ef01bd 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.109 2005/06/28 05:08:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.110 2005/07/20 16:42:30 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -292,6 +292,15 @@ assign_timezone(const char *value, bool doit, GucSource source) pfree(interval); return NULL; } + if (interval->day != 0) + { + if (source >= PGC_S_INTERACTIVE) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("invalid interval value for time zone: day not allowed"))); + pfree(interval); + return NULL; + } if (doit) { /* Here we change from SQL to Unix sign convention */ @@ -414,6 +423,7 @@ show_timezone(void) Interval interval; interval.month = 0; + interval.day = 0; #ifdef HAVE_INT64_TIMESTAMP interval.time = -(CTimeZone * USECS_PER_SEC); #else -- cgit v1.2.3