mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix typo for default units for timespan input.
Place single-ticks around bad argument in elog messages. Fix tabbing of large lookup tables (ugh).
This commit is contained in:
		@@ -7,7 +7,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.40 1997/09/08 21:48:23 momjian Exp $
 | 
			
		||||
 *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.41 1997/09/20 16:20:29 thomas Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@@ -115,7 +115,7 @@ datetime_in(char *str)
 | 
			
		||||
 | 
			
		||||
	if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
 | 
			
		||||
	  || (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz) != 0))
 | 
			
		||||
		elog(WARN, "Bad datetime external representation %s", str);
 | 
			
		||||
		elog(WARN, "Bad datetime external representation '%s'", str);
 | 
			
		||||
 | 
			
		||||
	result = PALLOCTYPE(DateTime);
 | 
			
		||||
 | 
			
		||||
@@ -123,7 +123,7 @@ datetime_in(char *str)
 | 
			
		||||
	{
 | 
			
		||||
		case DTK_DATE:
 | 
			
		||||
			if (tm2datetime(tm, fsec, &tz, result) != 0)
 | 
			
		||||
				elog(WARN, "Datetime out of range %s", str);
 | 
			
		||||
				elog(WARN, "Datetime out of range '%s'", str);
 | 
			
		||||
 | 
			
		||||
#ifdef DATEDEBUG
 | 
			
		||||
			printf("datetime_in- date is %f\n", *result);
 | 
			
		||||
@@ -243,7 +243,7 @@ timespan_in(char *str)
 | 
			
		||||
#if FALSE
 | 
			
		||||
				TIMESPAN_INVALID(span);
 | 
			
		||||
#endif
 | 
			
		||||
				elog(WARN, "Bad timespan external representation %s", str);
 | 
			
		||||
				elog(WARN, "Bad timespan external representation '%s'", str);
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
@@ -1488,7 +1488,7 @@ datetime_trunc(text *units, DateTime *datetime)
 | 
			
		||||
					break;
 | 
			
		||||
 | 
			
		||||
				default:
 | 
			
		||||
					elog(WARN, "Datetime units %s not supported", lowunits);
 | 
			
		||||
					elog(WARN, "Datetime units '%s' not supported", lowunits);
 | 
			
		||||
					result = NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1521,7 +1521,7 @@ datetime_trunc(text *units, DateTime *datetime)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (tm2datetime(tm, fsec, &tz, result) != 0)
 | 
			
		||||
				elog(WARN, "Unable to truncate datetime to %s", lowunits);
 | 
			
		||||
				elog(WARN, "Unable to truncate datetime to '%s'", lowunits);
 | 
			
		||||
 | 
			
		||||
#if FALSE
 | 
			
		||||
		}
 | 
			
		||||
@@ -1534,7 +1534,7 @@ datetime_trunc(text *units, DateTime *datetime)
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			elog(WARN, "Datetime units %s not recognized", lowunits);
 | 
			
		||||
			elog(WARN, "Datetime units '%s' not recognized", lowunits);
 | 
			
		||||
			result = NULL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -1631,12 +1631,12 @@ timespan_trunc(text *units, TimeSpan *timespan)
 | 
			
		||||
					break;
 | 
			
		||||
 | 
			
		||||
				default:
 | 
			
		||||
					elog(WARN, "Timespan units %s not supported", lowunits);
 | 
			
		||||
					elog(WARN, "Timespan units '%s' not supported", lowunits);
 | 
			
		||||
					result = NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (tm2timespan(tm, fsec, result) != 0)
 | 
			
		||||
				elog(WARN, "Unable to truncate timespan to %s", lowunits);
 | 
			
		||||
				elog(WARN, "Unable to truncate timespan to '%s'", lowunits);
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
@@ -1660,7 +1660,7 @@ timespan_trunc(text *units, TimeSpan *timespan)
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		elog(WARN, "Timespan units %s not recognized", units);
 | 
			
		||||
		elog(WARN, "Timespan units '%s' not recognized", units);
 | 
			
		||||
		result = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1782,7 +1782,7 @@ datetime_part(text *units, DateTime *datetime)
 | 
			
		||||
					break;
 | 
			
		||||
 | 
			
		||||
				default:
 | 
			
		||||
					elog(WARN, "Datetime units %s not supported", lowunits);
 | 
			
		||||
					elog(WARN, "Datetime units '%s' not supported", lowunits);
 | 
			
		||||
					*result = 0;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1804,14 +1804,14 @@ datetime_part(text *units, DateTime *datetime)
 | 
			
		||||
					break;
 | 
			
		||||
 | 
			
		||||
				default:
 | 
			
		||||
					elog(WARN, "Datetime units %s not supported", lowunits);
 | 
			
		||||
					elog(WARN, "Datetime units '%s' not supported", lowunits);
 | 
			
		||||
					*result = 0;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			elog(WARN, "Datetime units %s not recognized", lowunits);
 | 
			
		||||
			elog(WARN, "Datetime units '%s' not recognized", lowunits);
 | 
			
		||||
			*result = 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -1925,7 +1925,7 @@ timespan_part(text *units, TimeSpan *timespan)
 | 
			
		||||
					break;
 | 
			
		||||
 | 
			
		||||
				default:
 | 
			
		||||
					elog(WARN, "Timespan units %s not yet supported", units);
 | 
			
		||||
					elog(WARN, "Timespan units '%s' not yet supported", units);
 | 
			
		||||
					result = NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1949,7 +1949,7 @@ timespan_part(text *units, TimeSpan *timespan)
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		elog(WARN, "Timespan units %s not recognized", units);
 | 
			
		||||
		elog(WARN, "Timespan units '%s' not recognized", units);
 | 
			
		||||
		*result = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -2039,7 +2039,7 @@ datetime_zone(text *zone, DateTime *datetime)
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		elog(WARN, "Time zone %s not recognized", lowzone);
 | 
			
		||||
		elog(WARN, "Time zone '%s' not recognized", lowzone);
 | 
			
		||||
		result = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -2070,8 +2070,7 @@ static datetkn datetktbl[] = {
 | 
			
		||||
	{"acsst",		DTZ,		63},			/* Cent. Australia */
 | 
			
		||||
	{"acst",		TZ,			57},			/* Cent. Australia */
 | 
			
		||||
	{DA_D,			ADBC,		AD},			/* "ad" for years >= 0 */
 | 
			
		||||
	{"abstime", IGNORE, 0},		/* "abstime" for pre-v6.1 "Invalid
 | 
			
		||||
								 * Abstime" */
 | 
			
		||||
	{"abstime",		IGNORE,		0},				/* "abstime" for pre-v6.1 "Invalid Abstime" */
 | 
			
		||||
	{"adt",			DTZ,		NEG(18)},		/* Atlantic Daylight Time */
 | 
			
		||||
	{"aesst",		DTZ,		66},			/* E. Australia */
 | 
			
		||||
	{"aest",		TZ,			60},			/* Australia Eastern Std Time */
 | 
			
		||||
@@ -2125,10 +2124,9 @@ static datetkn datetktbl[] = {
 | 
			
		||||
	{"hmt",			DTZ,		18},			/* Hellas ? ? */
 | 
			
		||||
	{"hst",			TZ,			NEG(60)},		/* Hawaii Std Time */
 | 
			
		||||
	{"idle",		TZ,			72},			/* Intl. Date Line,	East */
 | 
			
		||||
	{"idlw", TZ, NEG(72)},		/* Intl. Date Line, West */
 | 
			
		||||
	{"idlw",		TZ,			NEG(72)},		/* Intl. Date Line,,	est */
 | 
			
		||||
	{LATE,			RESERV,		DTK_LATE},		/* "infinity" reserved for "late time" */
 | 
			
		||||
	{INVALID, RESERV, DTK_INVALID},		/* "invalid" reserved for invalid
 | 
			
		||||
										 * time */
 | 
			
		||||
	{INVALID,		RESERV,		DTK_INVALID},	/* "invalid" reserved for invalid time */
 | 
			
		||||
	{"ist",			TZ,			12},			/* Israel */
 | 
			
		||||
	{"it",			TZ,			22},			/* Iran Time */
 | 
			
		||||
	{"jan",			MONTH,		1},
 | 
			
		||||
@@ -2192,8 +2190,7 @@ static datetkn datetktbl[] = {
 | 
			
		||||
	{"tue",			DOW,		2},
 | 
			
		||||
	{"tues",		DOW,		2},
 | 
			
		||||
	{"tuesday",		DOW,		2},
 | 
			
		||||
	{"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid
 | 
			
		||||
										 * time */
 | 
			
		||||
	{"undefined",	RESERV,		DTK_INVALID},	/* "undefined" pre-v6.1 invalid time */
 | 
			
		||||
	{"ut",			TZ,			0},
 | 
			
		||||
	{"utc",			TZ,			0},
 | 
			
		||||
	{"wadt",		DTZ,		48},			/* West Australian DST */
 | 
			
		||||
@@ -2230,7 +2227,7 @@ static datetkn deltatktbl[] = {
 | 
			
		||||
	{DDAY,			UNITS,		DTK_DAY},		/* "day" relative time units */
 | 
			
		||||
	{"days",		UNITS,		DTK_DAY},		/* "days" relative time units */
 | 
			
		||||
	{"dec",			UNITS,		DTK_DECADE},	/* "decade" relative time units */
 | 
			
		||||
	{"decs", UNITS, DTK_DECADE},/* "decades" relative time units */
 | 
			
		||||
	{"decs",		UNITS,		DTK_DECADE},	/* "decades" relative time units */
 | 
			
		||||
	{DDECADE,		UNITS,		DTK_DECADE},	/* "decade" relative time units */
 | 
			
		||||
	{"decades",		UNITS,		DTK_DECADE},	/* "decades" relative time units */
 | 
			
		||||
	{"h",			UNITS,		DTK_HOUR},		/* "hour" relative time units */
 | 
			
		||||
@@ -2238,57 +2235,44 @@ static datetkn deltatktbl[] = {
 | 
			
		||||
	{"hours",		UNITS,		DTK_HOUR},		/* "hours" relative time units */
 | 
			
		||||
	{"hr",			UNITS,		DTK_HOUR},		/* "hour" relative time units */
 | 
			
		||||
	{"hrs",			UNITS,		DTK_HOUR},		/* "hours" relative time units */
 | 
			
		||||
	{INVALID, RESERV, DTK_INVALID},		/* "invalid" reserved for invalid
 | 
			
		||||
										 * time */
 | 
			
		||||
	{INVALID,		RESERV,		DTK_INVALID},	/* "invalid" reserved for invalid time */
 | 
			
		||||
	{"m",			UNITS,		DTK_MINUTE},	/* "minute" relative time units */
 | 
			
		||||
	{"microsecon", UNITS, DTK_MILLISEC},		/* "microsecond" relative
 | 
			
		||||
												 * time units */
 | 
			
		||||
	{"microsecon",	UNITS,		DTK_MILLISEC},	/* "microsecond" relative time units */
 | 
			
		||||
	{"mil",			UNITS,		DTK_MILLENIUM},	/* "millenium" relative time units */
 | 
			
		||||
	{"mils",		UNITS,		DTK_MILLENIUM},	/* "millenia" relative time units */
 | 
			
		||||
	{"millenia",	UNITS,		DTK_MILLENIUM},	/* "millenia" relative time units */
 | 
			
		||||
	{DMILLENIUM,	UNITS,		DTK_MILLENIUM},	/* "millenium" relative time units */
 | 
			
		||||
	{"millisecon", UNITS, DTK_MILLISEC},		/* "millisecond" relative
 | 
			
		||||
												 * time units */
 | 
			
		||||
	{"millisecon",	UNITS,		DTK_MILLISEC},	/* "millisecond" relative time units */
 | 
			
		||||
	{"min",			UNITS,		DTK_MINUTE},	/* "minute" relative time units */
 | 
			
		||||
	{"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */
 | 
			
		||||
	{"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */
 | 
			
		||||
	{"mins",		UNITS,		DTK_MINUTE},	/* "minutes" relative time units */
 | 
			
		||||
	{"mins",		UNITS,		DTK_MINUTE},	/* "minutes" relative time units */
 | 
			
		||||
	{DMINUTE,		UNITS,		DTK_MINUTE},	/* "minute" relative time units */
 | 
			
		||||
	{"minutes",		UNITS,		DTK_MINUTE},	/* "minutes" relative time units */
 | 
			
		||||
	{"mon",			UNITS,		DTK_MONTH},		/* "months" relative time units */
 | 
			
		||||
	{"mons",		UNITS,		DTK_MONTH},		/* "months" relative time units */
 | 
			
		||||
	{DMONTH,		UNITS,		DTK_MONTH},		/* "month" relative time units */
 | 
			
		||||
	{"months",		UNITS,		DTK_MONTH},		/* "months" relative time units */
 | 
			
		||||
	{"ms", UNITS, DTK_MILLISEC},/* "millisecond" relative time units */
 | 
			
		||||
	{"msec", UNITS, DTK_MILLISEC},		/* "millisecond" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{DMILLISEC, UNITS, DTK_MILLISEC},	/* "millisecond" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{"mseconds", UNITS, DTK_MILLISEC},	/* "milliseconds" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{"msecs", UNITS, DTK_MILLISEC},		/* "milliseconds" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{"qtr", UNITS, DTK_QUARTER},/* "quarter" relative time units */
 | 
			
		||||
	{"ms",			UNITS,		DTK_MILLISEC},	/* "millisecond" relative time units */
 | 
			
		||||
	{"msec",		UNITS,		DTK_MILLISEC},	/* "millisecond" relative time units */
 | 
			
		||||
	{DMILLISEC,		UNITS,		DTK_MILLISEC},	/* "millisecond" relative time units */
 | 
			
		||||
	{"mseconds",	UNITS,		DTK_MILLISEC},	/* "milliseconds" relative time units */
 | 
			
		||||
	{"msecs",		UNITS,		DTK_MILLISEC},	/* "milliseconds" relative time units */
 | 
			
		||||
	{"qtr",			UNITS,		DTK_QUARTER},	/* "quarter" relative time units */
 | 
			
		||||
	{DQUARTER,		UNITS,		DTK_QUARTER},	/* "quarter" relative time units */
 | 
			
		||||
	{"reltime", IGNORE, 0},		/* "reltime" for pre-v6.1 "Undefined
 | 
			
		||||
								 * Reltime" */
 | 
			
		||||
	{"reltime",		IGNORE,		0},				/* "reltime" for pre-v6.1 "Undefined Reltime" */
 | 
			
		||||
	{"s",			UNITS,		DTK_SECOND},	/* "second" relative time units */
 | 
			
		||||
	{"sec",			UNITS,		DTK_SECOND},	/* "second" relative time units */
 | 
			
		||||
	{DSECOND,		UNITS,		DTK_SECOND},	/* "second" relative time units */
 | 
			
		||||
	{"seconds",		UNITS,		DTK_SECOND},	/* "seconds" relative time units */
 | 
			
		||||
	{"secs", UNITS, DTK_SECOND},/* "seconds" relative time units */
 | 
			
		||||
	{"secs",		UNITS,		DTK_SECOND},	/* "seconds" relative time units */
 | 
			
		||||
	{DTIMEZONE,		UNITS,		DTK_TZ},		/* "timezone" time offset */
 | 
			
		||||
	{"tz",			UNITS,		DTK_TZ},		/* "timezone" time offset */
 | 
			
		||||
	{"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid
 | 
			
		||||
										 * time */
 | 
			
		||||
	{"us", UNITS, DTK_MICROSEC},/* "microsecond" relative time units */
 | 
			
		||||
	{"usec", UNITS, DTK_MICROSEC},		/* "microsecond" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{DMICROSEC, UNITS, DTK_MICROSEC},	/* "microsecond" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{"useconds", UNITS, DTK_MICROSEC},	/* "microseconds" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{"usecs", UNITS, DTK_MICROSEC},		/* "microseconds" relative time
 | 
			
		||||
										 * units */
 | 
			
		||||
	{"undefined",	RESERV,		DTK_INVALID},	/* "undefined" pre-v6.1 invalid time */
 | 
			
		||||
	{"us",			UNITS,		DTK_MICROSEC},	/* "microsecond" relative time units */
 | 
			
		||||
	{"usec",		UNITS,		DTK_MICROSEC},	/* "microsecond" relative time units */
 | 
			
		||||
	{DMICROSEC,		UNITS,		DTK_MICROSEC},	/* "microsecond" relative time units */
 | 
			
		||||
	{"useconds",	UNITS,		DTK_MICROSEC},	/* "microseconds" relative time units */
 | 
			
		||||
	{"usecs",		UNITS,		DTK_MICROSEC},	/* "microseconds" relative time units */
 | 
			
		||||
	{"w",			UNITS,		DTK_WEEK},		/* "week" relative time units */
 | 
			
		||||
	{DWEEK,			UNITS,		DTK_WEEK},		/* "week" relative time units */
 | 
			
		||||
	{"weeks",		UNITS,		DTK_WEEK},		/* "weeks" relative time units */
 | 
			
		||||
@@ -3719,7 +3703,6 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
 | 
			
		||||
 | 
			
		||||
#if READ_FORWARD
 | 
			
		||||
	int			is_neg = FALSE;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	int			fmask = 0,
 | 
			
		||||
@@ -3734,7 +3717,7 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
 | 
			
		||||
 | 
			
		||||
	*dtype = DTK_DELTA;
 | 
			
		||||
 | 
			
		||||
	type = SECOND;
 | 
			
		||||
	type = DTK_SECOND;
 | 
			
		||||
	tm->tm_year = 0;
 | 
			
		||||
	tm->tm_mon = 0;
 | 
			
		||||
	tm->tm_mday = 0;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user