Skip to content

Commit 791359f

Browse files
committed
Fix EncodeSpecialTimestamp to throw error on unrecognized input, rather than
returning a failure code that none of its callers bothered to check for.
1 parent f346a23 commit 791359f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/backend/utils/adt/timestamp.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.192 2008/09/11 15:27:30 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.193 2008/10/14 15:44:29 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -64,7 +64,7 @@ typedef struct
6464

6565

6666
static TimeOffset time2t(const int hour, const int min, const int sec, const fsec_t fsec);
67-
static int EncodeSpecialTimestamp(Timestamp dt, char *str);
67+
static void EncodeSpecialTimestamp(Timestamp dt, char *str);
6868
static Timestamp dt2local(Timestamp dt, int timezone);
6969
static void AdjustTimestampForTypmod(Timestamp *time, int32 typmod);
7070
static void AdjustIntervalForTypmod(Interval *interval, int32 typmod);
@@ -1150,18 +1150,16 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
11501150
/* EncodeSpecialTimestamp()
11511151
* Convert reserved timestamp data type to string.
11521152
*/
1153-
static int
1153+
static void
11541154
EncodeSpecialTimestamp(Timestamp dt, char *str)
11551155
{
11561156
if (TIMESTAMP_IS_NOBEGIN(dt))
11571157
strcpy(str, EARLY);
11581158
else if (TIMESTAMP_IS_NOEND(dt))
11591159
strcpy(str, LATE);
1160-
else
1161-
return FALSE;
1162-
1163-
return TRUE;
1164-
} /* EncodeSpecialTimestamp() */
1160+
else /* shouldn't happen */
1161+
elog(ERROR, "invalid argument for EncodeSpecialTimestamp");
1162+
}
11651163

11661164
Datum
11671165
now(PG_FUNCTION_ARGS)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy