From 666cbae16da46b833f57ef8b12ff0bf215684d9c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 12 Jun 2019 11:29:53 +0200 Subject: Remove explicit error handling for obsolete date/time values The date/time values 'current', 'invalid', and 'undefined' were removed a long time ago, but the code still contains explicit error handling for the transition. To simplify the code and avoid having to handle these values everywhere, just remove the recognition of these tokens altogether now. Reviewed-by: Michael Paquier --- src/interfaces/ecpg/pgtypeslib/dt.h | 2 -- src/interfaces/ecpg/pgtypeslib/dt_common.c | 5 ----- src/interfaces/ecpg/pgtypeslib/timestamp.c | 4 ---- 3 files changed, 11 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgtypeslib/dt.h index a9884f278cf..c5fd6bdaed9 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt.h +++ b/src/interfaces/ecpg/pgtypeslib/dt.h @@ -143,8 +143,6 @@ typedef int32 fsec_t; #define DTK_AGO 5 #define DTK_SPECIAL 6 -#define DTK_INVALID 7 -#define DTK_CURRENT 8 #define DTK_EARLY 9 #define DTK_LATE 10 #define DTK_EPOCH 11 diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c index f5aed794fda..24fff28f0ae 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt_common.c +++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c @@ -111,7 +111,6 @@ static const datetkn datetktbl[] = { #endif {"cot", TZ, -18000}, /* Columbia Time */ {"cst", TZ, -21600}, /* Central Standard Time */ - {DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */ #if 0 cvst #endif @@ -201,7 +200,6 @@ static const datetkn datetktbl[] = { idt /* Israeli, Iran, Indian Daylight Time */ #endif {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */ - {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */ {"iot", TZ, 18000}, /* Indian Chagos Time */ {"irkst", DTZ, 32400}, /* Irkutsk Summer Time */ {"irkt", TZ, 28800}, /* Irkutsk Time */ @@ -372,7 +370,6 @@ static const datetkn datetktbl[] = { #endif {"ulast", DTZ, 32400}, /* Ulan Bator Summer Time */ {"ulat", TZ, 28800}, /* Ulan Bator Time */ - {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */ {"ut", TZ, 0}, {"utc", TZ, 0}, {"uyst", DTZ, -7200}, /* Uruguay Summer Time */ @@ -440,7 +437,6 @@ static const datetkn deltatktbl[] = { {"hours", UNITS, DTK_HOUR}, /* "hours" relative */ {"hr", UNITS, DTK_HOUR}, /* "hour" relative */ {"hrs", UNITS, DTK_HOUR}, /* "hours" relative */ - {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */ {"m", UNITS, DTK_MINUTE}, /* "minute" relative */ {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ @@ -471,7 +467,6 @@ static const datetkn deltatktbl[] = { {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */ {"timezone_h", UNITS, DTK_TZ_HOUR}, /* timezone hour units */ {"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */ - {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */ {"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative */ diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index a7e0fe66f08..efd9f3aa719 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -253,10 +253,6 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) TIMESTAMP_NOBEGIN(result); break; - case DTK_INVALID: - errno = PGTYPES_TS_BAD_TIMESTAMP; - return noresult; - default: errno = PGTYPES_TS_BAD_TIMESTAMP; return noresult; -- cgit v1.2.3