Re: [HACKERS] 6.1 jumbo patch? - Mailing list pgsql-hackers
| From | Thomas G. Lockhart |
|---|---|
| Subject | Re: [HACKERS] 6.1 jumbo patch? |
| Date | |
| Msg-id | a891b4c0637dfa0ef669e3a4f448f121 Whole thread Raw |
| In response to | [HACKERS] 6.1 jumbo patch? (Bruce Momjian <maillist@candle.pha.pa.us>) |
| List | pgsql-hackers |
This is a multi-part message in MIME format.
- --------------6DEE9463D0C767416420B4C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
> > > With the 6.1 release two weeks old, and no one really adding any new
> > > feature,
Ahem, I have some date/time functions to add (such as date_trunc() and
age()), but wanted to see if there will be a non-dump/reload patch
release before proceeding. Also, has there been some discussion on
whether it will be OK to assume that all full releases will be
dump/reload? Seems that with pgdump_all that isn't much of a problem.
> > > is it a good idea to think about creating a 6.1 patch in the
> > > next week or so to add some fixes?
> > >
> > > I have the ownership preservation code installed, there could be an
> > > endian-communication patch, a datetime patch, and perhaps some others.
> >
> > + datestyle fix...
> >
> > Also, I have patch to avoid unnecessary fsyncs (now 'copy ... from'
> > takes near the same time as with -F), but I have to test it more
> > on the next week...
> >
> > Also, I play with hash-indices now (so big, so slow ones)...
>
> Bruce,
>
> What is this datetime patch you speak of?
>
> I'm spending today looking at the datetime handling (actually, all of
> the timezone handling that trickles down from nabstime.c) -- my 6.1
> install on AIX 3.2.5 broke heavily, and I think I've finally figured
> out all of the problems.
There are strong indications that AIX 3.2.5 is not as friendly as AIX
4.1 for hosting Postgres. Darren seems to have figured out most of the
problems with AIX and has had good success with installing Postgres. How
stale is 3.2.5??
I'm enclosing some date/time patches for you to try before you do more
debugging. By all indications, AIX is toward the outer limits of a
standard Unix environment, but hopefully these patches will address some
of your problems. To install the patches, make a directory (called
patch?) at the same level as src, place these files inside, and then
type "patch < datetime.c.patch" etc.). Do a "make install", no need for
a dump/reload.
I applied these patches to the source tree today, so they should appear
in tonight's distribution.
The areas covered in these patches:
1) Set DateStyle = ... was mostly broken, now fixed.
2) If an explicit timezone is specified as input for a datetime or
abstime string, _and_ if that timezone is in Daylight Savings Time,
_and_ if it is not your default timezone, then the time is interpreted
as in your local timezone. Now fixed to use the explicit timezone
properly.
3) 'MET DST' (Middle Europe Daylight Savings Time with a space -
*sheesh*) is now interpreted properly. Any standard time followed by
whitespace and "DST" will become a US-rules daylight savings time.
4) datetime +/- timespan is incorrect when timespan includes months or
years as well as a countable time (e.g. days, hours, minutes, seconds)
and when the countable time pushes the months/years date arithmetic over
a month boundary (most likely to happen with times around a month
boundary). Fixed.
5) regression tests updated.
btw, if an upcoming jumbo-patch will require a dump/reload, then I have
another set of patches to apply which will fix abstime problems for 5
seconds in 2008 (don't ask :( Otherwise, it can wait until v6.2.
- Tom
- --------------6DEE9463D0C767416420B4C
Content-Type: text/plain; charset=us-ascii; name="datetime.out.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="datetime.out.patch"
*** ../src/test/regress/expected/datetime.out.orig Fri Jun 6 10:01:58 1997
- --- ../src/test/regress/expected/datetime.out Fri Jun 20 15:47:26 1997
***************
*** 443,449 ****
|Wed Feb 16 17:32:01.00 1898
|Mon Feb 16 17:32:01.00 1998 PST
|Sun Feb 16 17:32:01.00 2098
! |Thu Feb 27 17:32:01.00 1997 PST
|Fri Feb 28 17:32:01.00 1997 PST
|Sat Mar 01 17:32:01.00 1997 PST
|Tue Dec 30 17:32:01.00 1997 PST
- --- 443,449 ----
|Wed Feb 16 17:32:01.00 1898
|Mon Feb 16 17:32:01.00 1998 PST
|Sun Feb 16 17:32:01.00 2098
! |Fri Feb 28 17:32:01.00 1997 PST
|Fri Feb 28 17:32:01.00 1997 PST
|Sat Mar 01 17:32:01.00 1997 PST
|Tue Dec 30 17:32:01.00 1997 PST
***************
*** 510,522 ****
|Sun Feb 16 17:32:01.00 1896
|Fri Feb 16 17:32:01.00 1996 PST
|Thu Feb 16 17:32:01.00 2096
! |Mon Feb 27 17:32:01.00 1995 PST
|Tue Feb 28 17:32:01.00 1995 PST
|Wed Mar 01 17:32:01.00 1995 PST
|Sat Dec 30 17:32:01.00 1995 PST
|Sun Dec 31 17:32:01.00 1995 PST
|Mon Jan 01 17:32:01.00 1996 PST
! |Thu Feb 29 17:32:01.00 1996 PST
|Fri Mar 01 17:32:01.00 1996 PST
|Fri Mar 01 17:32:01.00 1996 PST
|Mon Dec 30 17:32:01.00 1996 PST
- --- 510,522 ----
|Sun Feb 16 17:32:01.00 1896
|Fri Feb 16 17:32:01.00 1996 PST
|Thu Feb 16 17:32:01.00 2096
! |Tue Feb 28 17:32:01.00 1995 PST
|Tue Feb 28 17:32:01.00 1995 PST
|Wed Mar 01 17:32:01.00 1995 PST
|Sat Dec 30 17:32:01.00 1995 PST
|Sun Dec 31 17:32:01.00 1995 PST
|Mon Jan 01 17:32:01.00 1996 PST
! |Wed Feb 28 17:32:01.00 1996 PST
|Fri Mar 01 17:32:01.00 1996 PST
|Fri Mar 01 17:32:01.00 1996 PST
|Mon Dec 30 17:32:01.00 1996 PST
- --------------6DEE9463D0C767416420B4C
Content-Type: text/plain; charset=us-ascii; name="dt.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dt.c.patch"
*** ../src/backend/utils/adt/dt.c.orig Tue Jun 3 10:01:00 1997
- --- ../src/backend/utils/adt/dt.c Fri Jun 20 16:23:23 1997
***************
*** 48,54 ****
* Macro to replace modf(), which is broken on some platforms.
*/
#define TMODULO(t,q,u) {q = ((t < 0)? ceil(t / u): floor(t / u)); \
! if (q != 0) t -= rint(q * u);}
/*****************************************************************************
- --- 48,70 ----
* Macro to replace modf(), which is broken on some platforms.
*/
#define TMODULO(t,q,u) {q = ((t < 0)? ceil(t / u): floor(t / u)); \
! if (q != 0) t -= rint(q * u);}
!
! void GetEpochTime( struct tm *tm);
!
! #define UTIME_MINYEAR (1901)
! #define UTIME_MINMONTH (12)
! #define UTIME_MINDAY (14)
! #define UTIME_MAXYEAR (2038)
! #define UTIME_MAXMONTH (01)
! #define UTIME_MAXDAY (18)
!
! #define IS_VALID_UTIME(y,m,d) (((y > UTIME_MINYEAR) \
! || ((y == UTIME_MINYEAR) && ((m > UTIME_MINMONTH) \
! || ((m == UTIME_MINMONTH) && (d >= UTIME_MINDAY))))) \
! && ((y < UTIME_MAXYEAR) \
! || ((y == UTIME_MAXYEAR) && ((m < UTIME_MAXMONTH) \
! || ((m == UTIME_MAXMONTH) && (d <= UTIME_MAXDAY))))))
/*****************************************************************************
***************
*** 79,86 ****
|| (DecodeDateTime( field, ftype, nf, &dtype, tm, &fsec, &tz) != 0))
elog(WARN,"Bad datetime external representation %s",str);
! if (!PointerIsValid(result = PALLOCTYPE(DateTime)))
! elog(WARN,"Memory allocation failed, can't input datetime '%s'",str);
switch (dtype) {
case DTK_DATE:
- --- 95,101 ----
|| (DecodeDateTime( field, ftype, nf, &dtype, tm, &fsec, &tz) != 0))
elog(WARN,"Bad datetime external representation %s",str);
! result = PALLOCTYPE(DateTime);
switch (dtype) {
case DTK_DATE:
***************
*** 146,153 ****
EncodeSpecialDateTime(DT_INVALID, buf);
};
! if (!PointerIsValid(result = PALLOC(strlen(buf)+1)))
! elog(WARN,"Memory allocation failed, can't output datetime",NULL);
strcpy( result, buf);
- --- 161,167 ----
EncodeSpecialDateTime(DT_INVALID, buf);
};
! result = PALLOC(strlen(buf)+1);
strcpy( result, buf);
***************
*** 189,196 ****
|| (DecodeDateDelta( field, ftype, nf, &dtype, tm, &fsec) != 0))
elog(WARN,"Bad timespan external representation '%s'",str);
! if (!PointerIsValid(span = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't input timespan '%s'",str);
switch (dtype) {
case DTK_DELTA:
- --- 203,209 ----
|| (DecodeDateDelta( field, ftype, nf, &dtype, tm, &fsec) != 0))
elog(WARN,"Bad timespan external representation '%s'",str);
! span = PALLOCTYPE(TimeSpan);
switch (dtype) {
case DTK_DELTA:
***************
*** 230,237 ****
if (EncodeTimeSpan(tm, fsec, DateStyle, buf) != 0)
elog(WARN,"Unable to format timespan",NULL);
! if (!PointerIsValid(result = PALLOC(strlen(buf)+1)))
! elog(WARN,"Memory allocation failed, can't output timespan",NULL);
strcpy( result, buf);
return( result);
- --- 243,249 ----
if (EncodeTimeSpan(tm, fsec, DateStyle, buf) != 0)
elog(WARN,"Unable to format timespan",NULL);
! result = PALLOC(strlen(buf)+1);
strcpy( result, buf);
return( result);
***************
*** 267,274 ****
* Relational operators for datetime.
*---------------------------------------------------------*/
- - void GetEpochTime( struct tm *tm);
- -
void
GetEpochTime( struct tm *tm)
{
- --- 279,284 ----
***************
*** 556,562 ****
* actual value.
*---------------------------------------------------------*/
! DateTime *datetime_smaller(DateTime *datetime1, DateTime *datetime2)
{
DateTime *result;
- --- 566,573 ----
* actual value.
*---------------------------------------------------------*/
! DateTime *
! datetime_smaller(DateTime *datetime1, DateTime *datetime2)
{
DateTime *result;
***************
*** 568,575 ****
dt1 = *datetime1;
dt2 = *datetime2;
! if (!PointerIsValid(result = PALLOCTYPE(DateTime)))
! elog(WARN,"Memory allocation failed, can't find smaller date",NULL);
if (DATETIME_IS_RELATIVE(dt1)) dt1 = SetDateTime(dt1);
if (DATETIME_IS_RELATIVE(dt2)) dt2 = SetDateTime(dt2);
- --- 579,585 ----
dt1 = *datetime1;
dt2 = *datetime2;
! result = PALLOCTYPE(DateTime);
if (DATETIME_IS_RELATIVE(dt1)) dt1 = SetDateTime(dt1);
if (DATETIME_IS_RELATIVE(dt2)) dt2 = SetDateTime(dt2);
***************
*** 585,591 ****
return(result);
} /* datetime_smaller() */
! DateTime *datetime_larger(DateTime *datetime1, DateTime *datetime2)
{
DateTime *result;
- --- 595,602 ----
return(result);
} /* datetime_smaller() */
! DateTime *
! datetime_larger(DateTime *datetime1, DateTime *datetime2)
{
DateTime *result;
***************
*** 597,604 ****
dt1 = *datetime1;
dt2 = *datetime2;
! if (!PointerIsValid(result = PALLOCTYPE(DateTime)))
! elog(WARN,"Memory allocation failed, can't find larger date",NULL);
if (DATETIME_IS_RELATIVE(dt1)) dt1 = SetDateTime(dt1);
if (DATETIME_IS_RELATIVE(dt2)) dt2 = SetDateTime(dt2);
- --- 608,614 ----
dt1 = *datetime1;
dt2 = *datetime2;
! result = PALLOCTYPE(DateTime);
if (DATETIME_IS_RELATIVE(dt1)) dt1 = SetDateTime(dt1);
if (DATETIME_IS_RELATIVE(dt2)) dt2 = SetDateTime(dt2);
***************
*** 615,621 ****
} /* datetime_larger() */
! TimeSpan *datetime_sub(DateTime *datetime1, DateTime *datetime2)
{
TimeSpan *result;
- --- 625,632 ----
} /* datetime_larger() */
! TimeSpan *
! datetime_sub(DateTime *datetime1, DateTime *datetime2)
{
TimeSpan *result;
***************
*** 627,634 ****
dt1 = *datetime1;
dt2 = *datetime2;
! if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't subtract dates",NULL);
if (DATETIME_IS_RELATIVE(dt1)) dt1 = SetDateTime(dt1);
if (DATETIME_IS_RELATIVE(dt2)) dt2 = SetDateTime(dt2);
- --- 638,644 ----
dt1 = *datetime1;
dt2 = *datetime2;
! result = PALLOCTYPE(TimeSpan);
if (DATETIME_IS_RELATIVE(dt1)) dt1 = SetDateTime(dt1);
if (DATETIME_IS_RELATIVE(dt2)) dt2 = SetDateTime(dt2);
***************
*** 654,668 ****
* Then, if the next month has fewer days, set the day of month
* to the last day of month.
*/
! DateTime *datetime_add_span(DateTime *datetime, TimeSpan *span)
{
DateTime *result;
if ((!PointerIsValid(datetime)) || (!PointerIsValid(span)))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(DateTime)))
! elog(WARN,"Memory allocation failed, can't add dates",NULL);
#ifdef DATEDEBUG
printf( "datetime_add_span- add %f to %d %f\n", *datetime, span->month, span->time);
- --- 664,681 ----
* Then, if the next month has fewer days, set the day of month
* to the last day of month.
*/
! DateTime *
! datetime_add_span(DateTime *datetime, TimeSpan *span)
{
DateTime *result;
+ DateTime dt;
+ int tz;
+ char *tzn;
if ((!PointerIsValid(datetime)) || (!PointerIsValid(span)))
return NULL;
! result = PALLOCTYPE(DateTime);
#ifdef DATEDEBUG
printf( "datetime_add_span- add %f to %d %f\n", *datetime, span->month, span->time);
***************
*** 675,687 ****
DATETIME_INVALID(*result);
} else {
! *result = (DATETIME_IS_RELATIVE(*datetime)? SetDateTime(*datetime): *datetime);
if (span->month != 0) {
struct tm tt, *tm = &tt;
double fsec;
! if (datetime2tm( *result, NULL, tm, &fsec, NULL) == 0) {
#ifdef DATEDEBUG
printf( "datetime_add_span- date was %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
#endif
- --- 688,706 ----
DATETIME_INVALID(*result);
} else {
! dt = (DATETIME_IS_RELATIVE(*datetime)? SetDateTime(*datetime): *datetime);
!
! #ifdef ROUND_ALL
! dt = JROUND(dt + span->time);
! #else
! dt = span->time;
! #endif
if (span->month != 0) {
struct tm tt, *tm = &tt;
double fsec;
! if (datetime2tm( dt, &tz, tm, &fsec, &tzn) == 0) {
#ifdef DATEDEBUG
printf( "datetime_add_span- date was %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
#endif
***************
*** 706,731 ****
#ifdef DATEDEBUG
printf( "datetime_add_span- date becomes %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
#endif
! if (tm2datetime( tm, fsec, NULL, result) != 0)
elog(WARN,"Unable to add datetime and timespan",NULL);
- -
} else {
DATETIME_INVALID(*result);
};
};
! #ifdef ROUND_ALL
! *result = JROUND(*result + span->time);
! #else
! *result += span->time;
! #endif
};
return(result);
} /* datetime_add_span() */
! DateTime *datetime_sub_span(DateTime *datetime, TimeSpan *span)
{
DateTime *result;
TimeSpan tspan;
- --- 725,746 ----
#ifdef DATEDEBUG
printf( "datetime_add_span- date becomes %d.%02d.%02d\n", tm->tm_year, tm->tm_mon, tm->tm_mday);
#endif
! if (tm2datetime( tm, fsec, &tz, &dt) != 0)
elog(WARN,"Unable to add datetime and timespan",NULL);
} else {
DATETIME_INVALID(*result);
};
};
! *result = dt;
};
return(result);
} /* datetime_add_span() */
! DateTime *
! datetime_sub_span(DateTime *datetime, TimeSpan *span)
{
DateTime *result;
TimeSpan tspan;
***************
*** 742,756 ****
} /* datetime_sub_span() */
! TimeSpan *timespan_um(TimeSpan *timespan)
{
TimeSpan *result;
if (!PointerIsValid(timespan))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't subtract dates",NULL);
result->time = -(timespan->time);
result->month = -(timespan->month);
- --- 757,771 ----
} /* datetime_sub_span() */
! TimeSpan *
! timespan_um(TimeSpan *timespan)
{
TimeSpan *result;
if (!PointerIsValid(timespan))
return NULL;
! result = PALLOCTYPE(TimeSpan);
result->time = -(timespan->time);
result->month = -(timespan->month);
***************
*** 759,765 ****
} /* timespan_um() */
! TimeSpan *timespan_smaller(TimeSpan *timespan1, TimeSpan *timespan2)
{
TimeSpan *result;
- --- 774,781 ----
} /* timespan_um() */
! TimeSpan *
! timespan_smaller(TimeSpan *timespan1, TimeSpan *timespan2)
{
TimeSpan *result;
***************
*** 768,775 ****
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't find smaller timespan",NULL);
if (TIMESPAN_IS_INVALID(*timespan1)) {
result->time = timespan2->time;
- --- 784,790 ----
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return NULL;
! result = PALLOCTYPE(TimeSpan);
if (TIMESPAN_IS_INVALID(*timespan1)) {
result->time = timespan2->time;
***************
*** 803,809 ****
return(result);
} /* timespan_smaller() */
! TimeSpan *timespan_larger(TimeSpan *timespan1, TimeSpan *timespan2)
{
TimeSpan *result;
- --- 818,825 ----
return(result);
} /* timespan_smaller() */
! TimeSpan *
! timespan_larger(TimeSpan *timespan1, TimeSpan *timespan2)
{
TimeSpan *result;
***************
*** 812,819 ****
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't find larger timespan",NULL);
if (TIMESPAN_IS_INVALID(*timespan1)) {
result->time = timespan2->time;
- --- 828,834 ----
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return NULL;
! result = PALLOCTYPE(TimeSpan);
if (TIMESPAN_IS_INVALID(*timespan1)) {
result->time = timespan2->time;
***************
*** 848,862 ****
} /* timespan_larger() */
! TimeSpan *timespan_add(TimeSpan *span1, TimeSpan *span2)
{
TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(span2)))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't add timespans",NULL);
result->month = (span1->month + span2->month);
result->time = JROUND(span1->time + span2->time);
- --- 863,877 ----
} /* timespan_larger() */
! TimeSpan *
! timespan_add(TimeSpan *span1, TimeSpan *span2)
{
TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(span2)))
return NULL;
! result = PALLOCTYPE(TimeSpan);
result->month = (span1->month + span2->month);
result->time = JROUND(span1->time + span2->time);
***************
*** 864,878 ****
return(result);
} /* timespan_add() */
! TimeSpan *timespan_sub(TimeSpan *span1, TimeSpan *span2)
{
TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(span2)))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
! elog(WARN,"Memory allocation failed, can't subtract timespans",NULL);
result->month = (span1->month - span2->month);
result->time = JROUND(span1->time - span2->time);
- --- 879,893 ----
return(result);
} /* timespan_add() */
! TimeSpan *
! timespan_sub(TimeSpan *span1, TimeSpan *span2)
{
TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(span2)))
return NULL;
! result = PALLOCTYPE(TimeSpan);
result->month = (span1->month - span2->month);
result->time = JROUND(span1->time - span2->time);
***************
*** 906,913 ****
len = (strlen(str)+VARHDRSZ);
! if (!PointerIsValid(result = PALLOC(len)))
! elog(WARN,"Memory allocation failed, can't convert datetime to text",NULL);
VARSIZE(result) = len;
memmove(VARDATA(result), str, (len-VARHDRSZ));
- --- 921,927 ----
len = (strlen(str)+VARHDRSZ);
! result = PALLOC(len);
VARSIZE(result) = len;
memmove(VARDATA(result), str, (len-VARHDRSZ));
***************
*** 964,971 ****
len = (strlen(str)+VARHDRSZ);
! if (!PointerIsValid(result = PALLOC(len)))
! elog(WARN,"Memory allocation failed, can't convert timespan to text",NULL);
VARSIZE(result) = len;
memmove(VARDATA(result), str, (len-VARHDRSZ));
- --- 978,984 ----
len = (strlen(str)+VARHDRSZ);
! result = PALLOC(len);
VARSIZE(result) = len;
memmove(VARDATA(result), str, (len-VARHDRSZ));
***************
*** 1022,1029 ****
if ((!PointerIsValid(units)) || (!PointerIsValid(datetime)))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(float64data)))
! elog(WARN,"Memory allocation failed, can't get date part",NULL);
up = VARDATA(units);
lp = lowunits;
- --- 1035,1041 ----
if ((!PointerIsValid(units)) || (!PointerIsValid(datetime)))
return NULL;
! result = PALLOCTYPE(float64data);
up = VARDATA(units);
lp = lowunits;
***************
*** 1031,1036 ****
- --- 1043,1051 ----
*lp = '\0';
type = DecodeUnits( 0, lowunits, &val);
+ if (type == IGNORE) {
+ type = DecodeSpecial( 0, lowunits, &val);
+ };
#ifdef DATEDEBUG
if (type == IGNORE) strcpy(lowunits, "(unknown)");
***************
*** 1039,1053 ****
if (DATETIME_NOT_FINITE(*datetime)) {
#if FALSE
elog(WARN,"Datetime is not finite",NULL);
#endif
*result = 0;
! } else if (type == UNITS) {
!
dt = (DATETIME_IS_RELATIVE(*datetime)? SetDateTime(*datetime): *datetime);
! if (datetime2tm( dt, &tz, tm, &fsec, &tzn) == 0) {
switch (val) {
case DTK_TZ:
*result = tz;
- --- 1054,1068 ----
if (DATETIME_NOT_FINITE(*datetime)) {
#if FALSE
+ /* should return null but Postgres doesn't like that currently. - tgl 97/06/12 */
elog(WARN,"Datetime is not finite",NULL);
#endif
*result = 0;
! } else {
dt = (DATETIME_IS_RELATIVE(*datetime)? SetDateTime(*datetime): *datetime);
! if ((type == UNITS) && (datetime2tm( dt, &tz, tm, &fsec, &tzn) == 0)) {
switch (val) {
case DTK_TZ:
*result = tz;
***************
*** 1102,1120 ****
break;
default:
! elog(WARN,"Datetime units %s not supported",units);
*result = 0;
};
} else {
! elog(NOTICE,"Datetime out of range",NULL);
*result = 0;
};
- -
- -
- - } else {
- - elog(WARN,"Datetime units %s not recognized",units);
- - *result = 0;
};
return(result);
- --- 1117,1134 ----
break;
default:
! elog(WARN,"Datetime units %s not supported",lowunits);
*result = 0;
};
+ } else if ((type == RESERV) && (val == DTK_EPOCH)) {
+ DATETIME_EPOCH(*result);
+ *result = dt - SetDateTime(*result);
+
} else {
! elog(WARN,"Datetime units %s not recognized",lowunits);
*result = 0;
};
};
return(result);
***************
*** 1138,1145 ****
if ((!PointerIsValid(units)) || (!PointerIsValid(timespan)))
return NULL;
! if (!PointerIsValid(result = PALLOCTYPE(float64data)))
! elog(WARN,"Memory allocation failed, can't get date part",NULL);
up = VARDATA(units);
lp = lowunits;
- --- 1152,1158 ----
if ((!PointerIsValid(units)) || (!PointerIsValid(timespan)))
return NULL;
! result = PALLOCTYPE(float64data);
up = VARDATA(units);
lp = lowunits;
***************
*** 1147,1152 ****
- --- 1160,1168 ----
*lp = '\0';
type = DecodeUnits( 0, lowunits, &val);
+ if (type == IGNORE) {
+ type = DecodeSpecial( 0, lowunits, &val);
+ };
#ifdef DATEDEBUG
if (type == IGNORE) strcpy(lowunits, "(unknown)");
***************
*** 1221,1226 ****
- --- 1237,1248 ----
*result = 0;
};
+ } else if ((type == RESERV) && (val == DTK_EPOCH)) {
+ *result = timespan->time;
+ if (timespan->month != 0) {
+ *result += ((365.25*86400)*(timespan->month / 12));
+ *result += ((30*86400)*(timespan->month % 12));
+ };
} else {
elog(WARN,"Timespan units %s not recognized",units);
***************
*** 1284,1290 ****
{ "dec", MONTH, 12},
{ "december", MONTH, 12},
{ "dnt", TZ, 6}, /* Dansk Normal Tid */
! { "dst", IGNORE, 0},
{ "east", TZ, NEG(60)}, /* East Australian Std Time */
{ "edt", DTZ, NEG(24)}, /* Eastern Daylight Time */
{ "eet", TZ, 12}, /* East. Europe, USSR Zone 1 */
- --- 1306,1312 ----
{ "dec", MONTH, 12},
{ "december", MONTH, 12},
{ "dnt", TZ, 6}, /* Dansk Normal Tid */
! { "dst", DTZMOD, 6},
{ "east", TZ, NEG(60)}, /* East Australian Std Time */
{ "edt", DTZ, NEG(24)}, /* Eastern Daylight Time */
{ "eet", TZ, 12}, /* East. Europe, USSR Zone 1 */
***************
*** 1491,1510 ****
* to avoid having to check year and day both. - tgl 97/05/08
*/
- - #define UTIME_MINYEAR (1901)
- - #define UTIME_MINMONTH (12)
- - #define UTIME_MINDAY (14)
- - #define UTIME_MAXYEAR (2038)
- - #define UTIME_MAXMONTH (01)
- - #define UTIME_MAXDAY (18)
- -
- - #define IS_VALID_UTIME(y,m,d) (((y > UTIME_MINYEAR) \
- - || ((y == UTIME_MINYEAR) && ((m > UTIME_MINMONTH) \
- - || ((m == UTIME_MINMONTH) && (d >= UTIME_MINDAY))))) \
- - && ((y < UTIME_MAXYEAR) \
- - || ((y == UTIME_MAXYEAR) && ((m < UTIME_MAXMONTH) \
- - || ((m == UTIME_MAXMONTH) && (d <= UTIME_MAXDAY))))))
- -
#define JULIAN_MINYEAR (-4713)
#define JULIAN_MINMONTH (11)
#define JULIAN_MINDAY (23)
- --- 1513,1518 ----
***************
*** 1522,1528 ****
- (3*((y+4900+m12)/100))/4 + d - 32075);
} /* date2j() */
! void j2date( int jd, int *year, int *month, int *day)
{
int j, y, m, d;
- --- 1530,1537 ----
- (3*((y+4900+m12)/100))/4 + d - 32075);
} /* date2j() */
! void
! j2date( int jd, int *year, int *month, int *day)
{
int j, y, m, d;
***************
*** 1545,1551 ****
return;
} /* j2date() */
! int j2day( int date)
{
int day;
- --- 1554,1561 ----
return;
} /* j2date() */
! int
! j2day( int date)
{
int day;
***************
*** 1766,1784 ****
} /* tm2timespan() */
! DateTime dt2local(DateTime dt, int tz)
{
dt -= tz;
dt = JROUND(dt);
return(dt);
} /* dt2local() */
! double time2t(const int hour, const int min, const double sec)
{
return((((hour*60)+min)*60)+sec);
} /* time2t() */
! void dt2time(DateTime jd, int *hour, int *min, double *sec)
{
double time;
- --- 1776,1797 ----
} /* tm2timespan() */
! DateTime
! dt2local(DateTime dt, int tz)
{
dt -= tz;
dt = JROUND(dt);
return(dt);
} /* dt2local() */
! double
! time2t(const int hour, const int min, const double sec)
{
return((((hour*60)+min)*60)+sec);
} /* time2t() */
! void
! dt2time(DateTime jd, int *hour, int *min, double *sec)
{
double time;
***************
*** 1940,1946 ****
tm->tm_sec = 0;
*fsec = 0;
tm->tm_isdst = -1; /* don't know daylight savings time status apriori */
! if (tzp != NULL) *tzp = CTimeZone;
for (i = 0; i < nf; i++) {
#ifdef DATEDEBUG
- --- 1953,1959 ----
tm->tm_sec = 0;
*fsec = 0;
tm->tm_isdst = -1; /* don't know daylight savings time status apriori */
! if (tzp != NULL) *tzp = 0;
for (i = 0; i < nf; i++) {
#ifdef DATEDEBUG
***************
*** 1995,2000 ****
- --- 2008,2014 ----
tmask = (DTK_DATE_M | DTK_TIME_M | DTK_M(TZ));
*dtype = DTK_DATE;
GetCurrentTime(tm);
+ if (tzp != NULL) *tzp = CTimeZone;
break;
case DTK_YESTERDAY:
***************
*** 2050,2056 ****
- --- 2064,2080 ----
tm->tm_mon = val;
break;
+ /* daylight savings time modifier (solves "MET DST" syntax) */
+ case DTZMOD:
+ tmask |= DTK_M(DTZ);
+ tm->tm_isdst = 1;
+ if (tzp == NULL) return -1;
+ *tzp += val * 60;
+ break;
+
case DTZ:
+ /* set mask for TZ here _or_ check for DTZ later when getting default timezone */
+ tmask |= DTK_M(TZ);
tm->tm_isdst = 1;
if (tzp == NULL) return -1;
*tzp = val * 60;
***************
*** 2628,2634 ****
*val = 0;
} else {
type = tp->type;
! if ((type == TZ) || (type == DTZ)) {
*val = FROMVAL(tp);
} else {
*val = tp->value;
- --- 2652,2658 ----
*val = 0;
} else {
type = tp->type;
! if ((type == TZ) || (type == DTZ) || (type == DTZMOD)) {
*val = FROMVAL(tp);
} else {
*val = tp->value;
- --------------6DEE9463D0C767416420B4C
Content-Type: text/plain; charset=us-ascii; name="dt.h.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dt.h.patch"
*** ../src/include/utils/dt.h.orig Tue Jun 3 16:02:41 1997
- --- ../src/include/utils/dt.h Fri Jun 20 15:43:04 1997
***************
*** 111,129 ****
#define TIME 4
#define TZ 5
#define DTZ 6
! #define IGNORE 7
! #define AMPM 8
! #define HOUR 9
! #define MINUTE 10
! #define SECOND 11
! #define DOY 12
! #define DOW 13
! #define UNITS 14
! #define ADBC 15
/* these are only for relative dates */
! #define ABS_BEFORE 14
! #define ABS_AFTER 15
! #define AGO 16
/*
* Token field definitions for time parsing and decoding.
- --- 111,130 ----
#define TIME 4
#define TZ 5
#define DTZ 6
! #define DTZMOD 7
! #define IGNORE 8
! #define AMPM 9
! #define HOUR 10
! #define MINUTE 11
! #define SECOND 12
! #define DOY 13
! #define DOW 14
! #define UNITS 15
! #define ADBC 16
/* these are only for relative dates */
! #define AGO 17
! #define ABS_BEFORE 18
! #define ABS_AFTER 19
/*
* Token field definitions for time parsing and decoding.
***************
*** 131,136 ****
- --- 132,138 ----
* At the moment, that means keep them within [-127,127].
* These are also used for bit masks in DecodeDateDelta()
* so actually restrict them to within [0,31] for now.
+ * - tgl 97/06/19
*/
#define DTK_NUMBER 0
- --------------6DEE9463D0C767416420B4C
Content-Type: text/plain; charset=us-ascii; name="horology.out.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="horology.out.patch"
*** ../src/test/regress/expected/horology.out.orig Sun Jun 1 04:02:52 1997
- --- ../src/test/regress/expected/horology.out Fri Jun 20 16:26:05 1997
***************
*** 50,60 ****
|Thu Feb 29 17:32:01.00 1996 PST|@ 10 days |Sun Mar 10 17:32:01.00 1996 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 10 days |Mon Mar 11 17:32:01.00 1996 PST
|Wed Feb 28 17:32:01.00 1996 PST|@ 3 mons |Tue May 28 18:32:01.00 1996 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 3 mons |Fri May 31 18:32:01.00 1996 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 3 mons |Sat Jun 01 18:32:01.00 1996 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons |Sun Jul 28 18:32:01.00 1996 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons 12 hours |Mon Jul 29 06:32:01.00 1996 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons |Wed Jul 31 18:32:01.00 1996 PDT
|Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons 12 hours |Thu Aug 01 06:32:01.00 1996 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons |Thu Aug 01 18:32:01.00 1996 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons 12 hours |Fri Aug 02 06:32:01.00 1996 PDT
- --- 50,60 ----
|Thu Feb 29 17:32:01.00 1996 PST|@ 10 days |Sun Mar 10 17:32:01.00 1996 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 10 days |Mon Mar 11 17:32:01.00 1996 PST
|Wed Feb 28 17:32:01.00 1996 PST|@ 3 mons |Tue May 28 18:32:01.00 1996 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 3 mons |Wed May 29 18:32:01.00 1996 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 3 mons |Sat Jun 01 18:32:01.00 1996 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons |Sun Jul 28 18:32:01.00 1996 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons 12 hours |Mon Jul 29 06:32:01.00 1996 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons |Mon Jul 29 18:32:01.00 1996 PDT
|Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons 12 hours |Thu Aug 01 06:32:01.00 1996 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons |Thu Aug 01 18:32:01.00 1996 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons 12 hours |Fri Aug 02 06:32:01.00 1996 PDT
***************
*** 106,113 ****
|Sun Dec 31 17:32:01.00 2000 PST|@ 5 mons 12 hours |Fri Jun 01 06:32:01.00 2001 PDT
|Mon Jan 01 17:32:01.00 2001 PST|@ 5 mons |Fri Jun 01 18:32:01.00 2001 PDT
|Mon Jan 01 17:32:01.00 2001 PST|@ 5 mons 12 hours |Sat Jun 02 06:32:01.00 2001 PDT
- - |Wed Feb 28 17:32:01.00 1996 PST|@ 6 years |Wed Feb 27 17:32:01.00 2002 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 6 years |Thu Feb 28 17:32:01.00 2002 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 6 years |Fri Mar 01 17:32:01.00 2002 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 6 years |Mon Dec 30 17:32:01.00 2002 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 6 years |Tue Dec 31 17:32:01.00 2002 PST
- --- 106,113 ----
|Sun Dec 31 17:32:01.00 2000 PST|@ 5 mons 12 hours |Fri Jun 01 06:32:01.00 2001 PDT
|Mon Jan 01 17:32:01.00 2001 PST|@ 5 mons |Fri Jun 01 18:32:01.00 2001 PDT
|Mon Jan 01 17:32:01.00 2001 PST|@ 5 mons 12 hours |Sat Jun 02 06:32:01.00 2001 PDT
|Thu Feb 29 17:32:01.00 1996 PST|@ 6 years |Thu Feb 28 17:32:01.00 2002 PST
+ |Wed Feb 28 17:32:01.00 1996 PST|@ 6 years |Thu Feb 28 17:32:01.00 2002 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 6 years |Fri Mar 01 17:32:01.00 2002 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 6 years |Mon Dec 30 17:32:01.00 2002 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 6 years |Tue Dec 31 17:32:01.00 2002 PST
***************
*** 116,123 ****
|Sat Jan 01 17:32:01.00 2000 PST|@ 6 years |Sun Jan 01 17:32:01.00 2006 PST
|Sun Dec 31 17:32:01.00 2000 PST|@ 6 years |Sun Dec 31 17:32:01.00 2006 PST
|Mon Jan 01 17:32:01.00 2001 PST|@ 6 years |Mon Jan 01 17:32:01.00 2007 PST
- - |Wed Feb 28 17:32:01.00 1996 PST|@ 34 years |Wed Feb 27 17:32:01.00 2030 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 34 years |Thu Feb 28 17:32:01.00 2030 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 34 years |Fri Mar 01 17:32:01.00 2030 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 34 years |Mon Dec 30 17:32:01.00 2030 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 34 years |Tue Dec 31 17:32:01.00 2030 PST
- --- 116,123 ----
|Sat Jan 01 17:32:01.00 2000 PST|@ 6 years |Sun Jan 01 17:32:01.00 2006 PST
|Sun Dec 31 17:32:01.00 2000 PST|@ 6 years |Sun Dec 31 17:32:01.00 2006 PST
|Mon Jan 01 17:32:01.00 2001 PST|@ 6 years |Mon Jan 01 17:32:01.00 2007 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 34 years |Thu Feb 28 17:32:01.00 2030 PST
+ |Wed Feb 28 17:32:01.00 1996 PST|@ 34 years |Thu Feb 28 17:32:01.00 2030 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 34 years |Fri Mar 01 17:32:01.00 2030 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 34 years |Mon Dec 30 17:32:01.00 2030 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 34 years |Tue Dec 31 17:32:01.00 2030 PST
***************
*** 134,141 ****
hundred|datetime |timespan |minus
-------+-------------------------------+-----------------------------+-------------------------------
|epoch |@ 34 years |Tue Dec 31 16:00:00.00 1935 PST
- - |Wed Feb 28 17:32:01.00 1996 PST|@ 34 years |Tue Feb 27 17:32:01.00 1962 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 34 years |Wed Feb 28 17:32:01.00 1962 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 34 years |Thu Mar 01 17:32:01.00 1962 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 34 years |Sun Dec 30 17:32:01.00 1962 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 34 years |Mon Dec 31 17:32:01.00 1962 PST
- --- 134,141 ----
hundred|datetime |timespan |minus
-------+-------------------------------+-----------------------------+-------------------------------
|epoch |@ 34 years |Tue Dec 31 16:00:00.00 1935 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 34 years |Wed Feb 28 17:32:01.00 1962 PST
+ |Wed Feb 28 17:32:01.00 1996 PST|@ 34 years |Wed Feb 28 17:32:01.00 1962 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 34 years |Thu Mar 01 17:32:01.00 1962 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 34 years |Sun Dec 30 17:32:01.00 1962 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 34 years |Mon Dec 31 17:32:01.00 1962 PST
***************
*** 152,159 ****
|epoch |@ 5 hours |Wed Dec 31 11:00:00.00 1969 PST
|epoch |@ 1 min |Wed Dec 31 15:59:00.00 1969 PST
|epoch |@ 14 secs ago |Wed Dec 31 16:00:14.00 1969 PST
- - |Wed Feb 28 17:32:01.00 1996 PST|@ 6 years |Tue Feb 27 17:32:01.00 1990 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 6 years |Wed Feb 28 17:32:01.00 1990 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 6 years |Thu Mar 01 17:32:01.00 1990 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 6 years |Sun Dec 30 17:32:01.00 1990 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 6 years |Mon Dec 31 17:32:01.00 1990 PST
- --- 152,159 ----
|epoch |@ 5 hours |Wed Dec 31 11:00:00.00 1969 PST
|epoch |@ 1 min |Wed Dec 31 15:59:00.00 1969 PST
|epoch |@ 14 secs ago |Wed Dec 31 16:00:14.00 1969 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 6 years |Wed Feb 28 17:32:01.00 1990 PST
+ |Wed Feb 28 17:32:01.00 1996 PST|@ 6 years |Wed Feb 28 17:32:01.00 1990 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 6 years |Thu Mar 01 17:32:01.00 1990 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 6 years |Sun Dec 30 17:32:01.00 1990 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 6 years |Mon Dec 31 17:32:01.00 1990 PST
***************
*** 163,174 ****
|Mon Jan 01 17:32:01.00 2001 PST|@ 6 years |Sun Jan 01 17:32:01.00 1995 PST
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons 12 hours |Thu Sep 28 06:32:01.00 1995 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons |Thu Sep 28 18:32:01.00 1995 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons 12 hours |Sat Sep 30 06:32:01.00 1995 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons |Sat Sep 30 18:32:01.00 1995 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons 12 hours |Sun Oct 01 06:32:01.00 1995 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons |Sun Oct 01 18:32:01.00 1995 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 3 mons |Tue Nov 28 17:32:01.00 1995 PST
! |Thu Feb 29 17:32:01.00 1996 PST|@ 3 mons |Thu Nov 30 17:32:01.00 1995 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 3 mons |Fri Dec 01 17:32:01.00 1995 PST
|Wed Feb 28 17:32:01.00 1996 PST|@ 10 days |Sun Feb 18 17:32:01.00 1996 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 10 days |Mon Feb 19 17:32:01.00 1996 PST
- --- 163,174 ----
|Mon Jan 01 17:32:01.00 2001 PST|@ 6 years |Sun Jan 01 17:32:01.00 1995 PST
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons 12 hours |Thu Sep 28 06:32:01.00 1995 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 5 mons |Thu Sep 28 18:32:01.00 1995 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons 12 hours |Fri Sep 29 06:32:01.00 1995 PDT
! |Thu Feb 29 17:32:01.00 1996 PST|@ 5 mons |Fri Sep 29 18:32:01.00 1995 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons 12 hours |Sun Oct 01 06:32:01.00 1995 PDT
|Fri Mar 01 17:32:01.00 1996 PST|@ 5 mons |Sun Oct 01 18:32:01.00 1995 PDT
|Wed Feb 28 17:32:01.00 1996 PST|@ 3 mons |Tue Nov 28 17:32:01.00 1995 PST
! |Thu Feb 29 17:32:01.00 1996 PST|@ 3 mons |Wed Nov 29 17:32:01.00 1995 PST
|Fri Mar 01 17:32:01.00 1996 PST|@ 3 mons |Fri Dec 01 17:32:01.00 1995 PST
|Wed Feb 28 17:32:01.00 1996 PST|@ 10 days |Sun Feb 18 17:32:01.00 1996 PST
|Thu Feb 29 17:32:01.00 1996 PST|@ 10 days |Mon Feb 19 17:32:01.00 1996 PST
***************
*** 189,196 ****
|Mon Dec 30 17:32:01.00 1996 PST|@ 5 mons |Tue Jul 30 18:32:01.00 1996 PDT
|Tue Dec 31 17:32:01.00 1996 PST|@ 5 mons 12 hours |Wed Jul 31 06:32:01.00 1996 PDT
|Tue Dec 31 17:32:01.00 1996 PST|@ 5 mons |Wed Jul 31 18:32:01.00 1996 PDT
- - |Mon Dec 30 17:32:01.00 1996 PST|@ 3 mons |Sun Sep 29 18:32:01.00 1996 PDT
|Tue Dec 31 17:32:01.00 1996 PST|@ 3 mons |Mon Sep 30 18:32:01.00 1996 PDT
|Mon Dec 30 17:32:01.00 1996 PST|@ 10 days |Fri Dec 20 17:32:01.00 1996 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 10 days |Sat Dec 21 17:32:01.00 1996 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 1 day 2 hours 3 mins 4 secs|Sun Dec 29 15:28:57.00 1996 PST
- --- 189,196 ----
|Mon Dec 30 17:32:01.00 1996 PST|@ 5 mons |Tue Jul 30 18:32:01.00 1996 PDT
|Tue Dec 31 17:32:01.00 1996 PST|@ 5 mons 12 hours |Wed Jul 31 06:32:01.00 1996 PDT
|Tue Dec 31 17:32:01.00 1996 PST|@ 5 mons |Wed Jul 31 18:32:01.00 1996 PDT
|Tue Dec 31 17:32:01.00 1996 PST|@ 3 mons |Mon Sep 30 18:32:01.00 1996 PDT
+ |Mon Dec 30 17:32:01.00 1996 PST|@ 3 mons |Mon Sep 30 18:32:01.00 1996 PDT
|Mon Dec 30 17:32:01.00 1996 PST|@ 10 days |Fri Dec 20 17:32:01.00 1996 PST
|Tue Dec 31 17:32:01.00 1996 PST|@ 10 days |Sat Dec 21 17:32:01.00 1996 PST
|Mon Dec 30 17:32:01.00 1996 PST|@ 1 day 2 hours 3 mins 4 secs|Sun Dec 29 15:28:57.00 1996 PST
- --------------6DEE9463D0C767416420B4C
Content-Type: text/plain; charset=us-ascii; name="variable.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="variable.c.patch"
*** ../src/backend/tcop/variable.c.orig Tue Jun 3 10:00:58 1997
- --- ../src/backend/tcop/variable.c Fri Jun 20 15:42:56 1997
***************
*** 8,13 ****
- --- 8,14 ----
#include <stdio.h>
#include <string.h>
+ #include <ctype.h>
#include "postgres.h"
#include "miscadmin.h"
#include "tcop/variable.h"
***************
*** 38,92 ****
{
const char *start;
int len = 0;
!
! *tok = *val = NULL;
!
if ( !(*str) )
return NULL;
!
/* skip white spaces */
! while ( *str == ' ' || *str == '\t' )
! str++;
if ( *str == ',' || *str == '=' )
elog(WARN, "Syntax error near (%s): empty setting", str);
if ( !(*str) )
return NULL;
!
start = str;
!
/*
* count chars in token until we hit white space or comma
* or '=' or end of string
*/
! while ( *str && *str != ' ' && *str != '\t'
! && *str != ',' && *str != '=' )
{
str++;
len++;
}
! *tok = (char*) palloc (len + 1);
strncpy (*tok, start, len);
(*tok)[len] = '\0';
/* skip white spaces */
! while ( *str == ' ' || *str == '\t' )
! str++;
!
! if ( !(*str) )
! return (NULL);
! if ( *str == ',' )
return (++str);
! if ( *str != '=' )
elog(WARN, "Syntax error near (%s)", str);
str++; /* '=': get value */
len = 0;
/* skip white spaces */
! while ( *str == ' ' || *str == '\t' )
! str++;
if ( *str == ',' || !(*str) )
elog(WARN, "Syntax error near (=%s)", str);
- --- 39,98 ----
{
const char *start;
int len = 0;
!
! *tok = NULL;
! if (val != NULL) *val = NULL;
!
if ( !(*str) )
return NULL;
!
/* skip white spaces */
! while (isspace(*str)) str++;
if ( *str == ',' || *str == '=' )
elog(WARN, "Syntax error near (%s): empty setting", str);
+
+ /* end of string? then return NULL */
if ( !(*str) )
return NULL;
!
! /* OK, at beginning of non-NULL string... */
start = str;
!
/*
* count chars in token until we hit white space or comma
* or '=' or end of string
*/
! while ( *str && (! isspace(*str))
! && *str != ',' && *str != '=' )
{
str++;
len++;
}
! *tok = (char*) PALLOC(len + 1);
strncpy (*tok, start, len);
(*tok)[len] = '\0';
/* skip white spaces */
! while ( isspace(*str)) str++;
!
! /* end of string? */
! if ( !(*str) ) {
! return(str);
!
! /* delimiter? */
! } else if ( *str == ',' ) {
return (++str);
! } else if ((val == NULL) || ( *str != '=' )) {
elog(WARN, "Syntax error near (%s)", str);
+ };
str++; /* '=': get value */
len = 0;
/* skip white spaces */
! while ( isspace(*str)) str++;
if ( *str == ',' || !(*str) )
elog(WARN, "Syntax error near (=%s)", str);
***************
*** 94,115 ****
start = str;
/*
! * count chars in token' value until we hit white space or comma
* or end of string
*/
! while ( *str && *str != ' ' && *str != '\t' && *str != ',' )
{
str++;
len++;
}
! *val = (char*) palloc (len + 1);
strncpy (*val, start, len);
(*val)[len] = '\0';
/* skip white spaces */
! while ( *str == ' ' || *str == '\t' )
! str++;
if ( !(*str) )
return (NULL);
- --- 100,120 ----
start = str;
/*
! * count chars in token's value until we hit white space or comma
* or end of string
*/
! while ( *str && (! isspace(*str)) && *str != ',' )
{
str++;
len++;
}
! *val = (char*) PALLOC(len + 1);
strncpy (*val, start, len);
(*val)[len] = '\0';
/* skip white spaces */
! while ( isspace(*str)) str++;
if ( !(*str) )
return (NULL);
***************
*** 120,142 ****
return str;
}
!
/*-----------------------------------------------------------------------*/
static bool parse_null(const char *value)
{
return TRUE;
}
!
static bool show_null(const char *value)
{
return TRUE;
}
!
static bool reset_null(const char *value)
{
return TRUE;
}
!
static bool parse_geqo (const char *value)
{
const char *rest;
- --- 125,147 ----
return str;
}
!
/*-----------------------------------------------------------------------*/
static bool parse_null(const char *value)
{
return TRUE;
}
!
static bool show_null(const char *value)
{
return TRUE;
}
!
static bool reset_null(const char *value)
{
return TRUE;
}
!
static bool parse_geqo (const char *value)
{
const char *rest;
***************
*** 146,153 ****
if ( tok == NULL )
elog(WARN, "Value undefined");
! if ( rest )
! elog(WARN, "Unacceptable data (%s)", rest);
if ( strcasecmp (tok, "on") == 0 )
{
- --- 151,158 ----
if ( tok == NULL )
elog(WARN, "Value undefined");
! if (( rest ) && ( *rest != '\0' ))
! elog(WARN, "Unable to parse '%s'", value);
if ( strcasecmp (tok, "on") == 0 )
{
***************
*** 158,178 ****
geqo_rels = pg_atoi (val, sizeof(int32), '\0');
if ( geqo_rels <= 1 )
elog(WARN, "Bad value for # of relations (%s)", val);
! pfree (val);
}
_use_geqo_ = true;
_use_geqo_rels_ = geqo_rels;
}
else if ( strcasecmp (tok, "off") == 0 )
{
! if ( val != NULL )
! elog(WARN, "Unacceptable data (%s)", val);
_use_geqo_ = false;
}
else
elog(WARN, "Bad value for GEQO (%s)", value);
! pfree (tok);
return TRUE;
}
- --- 163,183 ----
geqo_rels = pg_atoi (val, sizeof(int32), '\0');
if ( geqo_rels <= 1 )
elog(WARN, "Bad value for # of relations (%s)", val);
! PFREE(val);
}
_use_geqo_ = true;
_use_geqo_rels_ = geqo_rels;
}
else if ( strcasecmp (tok, "off") == 0 )
{
! if (( val != NULL ) && ( *val != '\0' ))
! elog(WARN, "%s does not allow a parameter",tok);
_use_geqo_ = false;
}
else
elog(WARN, "Bad value for GEQO (%s)", value);
! PFREE(tok);
return TRUE;
}
***************
*** 180,186 ****
{
if ( _use_geqo_ )
! elog (NOTICE, "GEQO is ON begining with %d relations", _use_geqo_rels_);
else
elog (NOTICE, "GEQO is OFF");
return TRUE;
- --- 185,191 ----
{
if ( _use_geqo_ )
! elog (NOTICE, "GEQO is ON beginning with %d relations", _use_geqo_rels_);
else
elog (NOTICE, "GEQO is OFF");
return TRUE;
***************
*** 197,203 ****
_use_geqo_rels_ = GEQO_RELS;
return TRUE;
}
!
static bool parse_r_plans (const char *value)
{
- --- 202,208 ----
_use_geqo_rels_ = GEQO_RELS;
return TRUE;
}
!
static bool parse_r_plans (const char *value)
{
***************
*** 231,237 ****
#endif
return TRUE;
}
!
static bool parse_cost_heap (const char *value)
{
float32 res = float4in ((char*)value);
- --- 236,242 ----
#endif
return TRUE;
}
!
static bool parse_cost_heap (const char *value)
{
float32 res = float4in ((char*)value);
***************
*** 278,293 ****
static bool parse_date(const char *value)
{
! char *tok, *val;
int dcnt = 0, ecnt = 0;
!
! while((value = get_token(&tok, &val, value)) != 0)
{
- - if ( val != NULL )
- - elog(WARN, "Syntax error near (%s)", val);
- -
/* Ugh. Somebody ought to write a table driven version -- mjl */
!
if(!strcasecmp(tok, "iso"))
{
DateStyle = USE_ISO_DATES;
- --- 283,295 ----
static bool parse_date(const char *value)
{
! char *tok;
int dcnt = 0, ecnt = 0;
!
! while((value = get_token(&tok, NULL, value)) != 0)
{
/* Ugh. Somebody ought to write a table driven version -- mjl */
!
if(!strcasecmp(tok, "iso"))
{
DateStyle = USE_ISO_DATES;
***************
*** 324,338 ****
{
elog(WARN, "Bad value for date style (%s)", tok);
}
! pfree (tok);
}
!
if(dcnt > 1 || ecnt > 1)
elog(NOTICE, "Conflicting settings for date");
return TRUE;
}
!
static bool show_date()
{
char buf[64];
- --- 326,340 ----
{
elog(WARN, "Bad value for date style (%s)", tok);
}
! PFREE(tok);
}
!
if(dcnt > 1 || ecnt > 1)
elog(NOTICE, "Conflicting settings for date");
return TRUE;
}
!
static bool show_date()
{
char buf[64];
***************
*** 357,363 ****
return TRUE;
}
!
static bool reset_date()
{
DateStyle = USE_POSTGRES_DATES;
- --- 359,365 ----
return TRUE;
}
!
static bool reset_date()
{
DateStyle = USE_POSTGRES_DATES;
***************
*** 365,371 ****
return TRUE;
}
!
/*-----------------------------------------------------------------------*/
struct VariableParsers
{
- --- 367,373 ----
return TRUE;
}
!
/*-----------------------------------------------------------------------*/
struct VariableParsers
{
***************
*** 390,402 ****
bool SetPGVariable(const char *name, const char *value)
{
struct VariableParsers *vp;
!
for(vp = VariableParsers; vp->name; vp++)
{
if(!strcasecmp(vp->name, name))
return (vp->parser)(value);
}
!
elog(NOTICE, "Unrecognized variable %s", name);
return TRUE;
- --- 392,404 ----
bool SetPGVariable(const char *name, const char *value)
{
struct VariableParsers *vp;
!
for(vp = VariableParsers; vp->name; vp++)
{
if(!strcasecmp(vp->name, name))
return (vp->parser)(value);
}
!
elog(NOTICE, "Unrecognized variable %s", name);
return TRUE;
***************
*** 406,418 ****
bool GetPGVariable(const char *name)
{
struct VariableParsers *vp;
!
for(vp = VariableParsers; vp->name; vp++)
{
if(!strcasecmp(vp->name, name))
return (vp->show)();
}
!
elog(NOTICE, "Unrecognized variable %s", name);
return TRUE;
- --- 408,420 ----
bool GetPGVariable(const char *name)
{
struct VariableParsers *vp;
!
for(vp = VariableParsers; vp->name; vp++)
{
if(!strcasecmp(vp->name, name))
return (vp->show)();
}
!
elog(NOTICE, "Unrecognized variable %s", name);
return TRUE;
***************
*** 422,434 ****
bool ResetPGVariable(const char *name)
{
struct VariableParsers *vp;
!
for(vp = VariableParsers; vp->name; vp++)
{
if(!strcasecmp(vp->name, name))
return (vp->reset)();
}
!
elog(NOTICE, "Unrecognized variable %s", name);
return TRUE;
- --- 424,436 ----
bool ResetPGVariable(const char *name)
{
struct VariableParsers *vp;
!
for(vp = VariableParsers; vp->name; vp++)
{
if(!strcasecmp(vp->name, name))
return (vp->reset)();
}
!
elog(NOTICE, "Unrecognized variable %s", name);
return TRUE;
- --------------6DEE9463D0C767416420B4C--
------------------------------
End of hackers-digest V1 #394
*****************************
pgsql-hackers by date: