1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Fix transposed arguments for typmod for one INTERVAL production.

Mask both typmod subfields for INTERVAL to avoid setting the high bit,
 per dire warning from Tom Lane.
Clear tmask for DTK_ISO_TIME case to avoid time zone troubles.
 Symptom reported by Tom Lane.
Clean up checking for valid time zone info in output routine.
 This should now work for both SQL99 and Unix-style time zones.
Put in explicit check for INTERVAL() typmod rounding to avoid accumulating
 cruft in the lower bits. Not sure that this helps, but we'll need to do
 something. The symptom is visible with a query like
 select interval(2) '10000 days 01:02:03.040506';
Regression tests are patched to repair the Tom Lane symptom, and all pass.
This commit is contained in:
Thomas G. Lockhart
2001-10-20 01:02:22 +00:00
parent 3a484d9e99
commit 424d9389d6
6 changed files with 114 additions and 57 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.89 2001/10/18 19:52:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.90 2001/10/20 01:02:18 thomas Exp $
*
* NOTES
*
@ -256,7 +256,7 @@ GetCurrentAbsoluteTimeUsec(int *usec)
};
return (AbsoluteTime) now;
} /* GetCurrentAbsoluteTime() */
} /* GetCurrentAbsoluteTimeUsec() */
void
@ -344,7 +344,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
{
*tzp = CTimeZone;
tm->tm_gmtoff = CTimeZone;
tm->tm_isdst = -1;
tm->tm_isdst = 0;
tm->tm_zone = NULL;
if (tzn != NULL)
*tzn = NULL;
@ -366,6 +366,10 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
}
}
}
else
{
tm->tm_isdst = -1;
}
#elif defined(HAVE_INT_TIMEZONE)
if (tzp != NULL)
{
@ -376,7 +380,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
if (HasCTZSet)
{
*tzp = CTimeZone;
tm->tm_isdst = -1;
tm->tm_isdst = 0;
if (tzn != NULL)
*tzn = NULL;
}
@ -397,6 +401,10 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
}
}
}
else
{
tm->tm_isdst = -1;
}
#endif
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
if (tzp != NULL)
@ -426,6 +434,10 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
}
}
}
else
{
tm->tm_isdst = -1;
}
#endif
return;