Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit791359f

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 parentf346a23 commit791359f

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
staticTimeOffsettime2t(constinthour,constintmin,constintsec,constfsec_tfsec);
67-
staticintEncodeSpecialTimestamp(Timestampdt,char*str);
67+
staticvoidEncodeSpecialTimestamp(Timestampdt,char*str);
6868
staticTimestampdt2local(Timestampdt,inttimezone);
6969
staticvoidAdjustTimestampForTypmod(Timestamp*time,int32typmod);
7070
staticvoidAdjustIntervalForTypmod(Interval*interval,int32typmod);
@@ -1150,18 +1150,16 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
11501150
/* EncodeSpecialTimestamp()
11511151
* Convert reserved timestamp data type to string.
11521152
*/
1153-
staticint
1153+
staticvoid
11541154
EncodeSpecialTimestamp(Timestampdt,char*str)
11551155
{
11561156
if (TIMESTAMP_IS_NOBEGIN(dt))
11571157
strcpy(str,EARLY);
11581158
elseif (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)

[8]ページ先頭

©2009-2025 Movatter.jp