diff options
author | Bruce Momjian <bruce@momjian.us> | 2005-07-20 16:42:32 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2005-07-20 16:42:32 +0000 |
commit | db05f4a7eb6c80c67c25ca9d28be825b99ed3553 (patch) | |
tree | dee67dee9058a0243609c838c6be521143d23f3b /src/backend/commands/variable.c | |
parent | 826604f9e61c233c4229a3eb4d1ee3945691ee1b (diff) | |
download | postgresql-db05f4a7eb6c80c67c25ca9d28be825b99ed3553.tar.gz postgresql-db05f4a7eb6c80c67c25ca9d28be825b99ed3553.zip |
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
Diffstat (limited to 'src/backend/commands/variable.c')
-rw-r--r-- | src/backend/commands/variable.c | 12 |
1 files changed, 11 insertions, 1 deletions
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 |