1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

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
This commit is contained in:
Bruce Momjian
2005-07-20 16:42:32 +00:00
parent 826604f9e6
commit db05f4a7eb
12 changed files with 286 additions and 181 deletions

View File

@ -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