diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-14 15:44:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-14 15:44:29 +0000 |
commit | 791359fe0eae83641f0929159d5861359d395e97 (patch) | |
tree | f8271892c0aa5d692fed78a95f6e67da068ba3e9 /src | |
parent | f346a232edc233858203ff4aa7774fdd4b53e1a5 (diff) | |
download | postgresql-791359fe0eae83641f0929159d5861359d395e97.tar.gz postgresql-791359fe0eae83641f0929159d5861359d395e97.zip |
Fix EncodeSpecialTimestamp to throw error on unrecognized input, rather than
returning a failure code that none of its callers bothered to check for.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/adt/timestamp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index acfc89ba047..7f80fc94211 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.192 2008/09/11 15:27:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.193 2008/10/14 15:44:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ typedef struct static TimeOffset time2t(const int hour, const int min, const int sec, const fsec_t fsec); -static int EncodeSpecialTimestamp(Timestamp dt, char *str); +static void EncodeSpecialTimestamp(Timestamp dt, char *str); static Timestamp dt2local(Timestamp dt, int timezone); static void AdjustTimestampForTypmod(Timestamp *time, int32 typmod); static void AdjustIntervalForTypmod(Interval *interval, int32 typmod); @@ -1150,18 +1150,16 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) /* EncodeSpecialTimestamp() * Convert reserved timestamp data type to string. */ -static int +static void EncodeSpecialTimestamp(Timestamp dt, char *str) { if (TIMESTAMP_IS_NOBEGIN(dt)) strcpy(str, EARLY); else if (TIMESTAMP_IS_NOEND(dt)) strcpy(str, LATE); - else - return FALSE; - - return TRUE; -} /* EncodeSpecialTimestamp() */ + else /* shouldn't happen */ + elog(ERROR, "invalid argument for EncodeSpecialTimestamp"); +} Datum now(PG_FUNCTION_ARGS) |