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

Commit9afc583

Browse files
committed
Reject nonzero day fields in AT TIME ZONE INTERVAL functions.
It's not sensible for an interval that's used as a time zone value to belarger than a day. When we changed the interval type to contain a separateday field, check_timezone() was adjusted to reject nonzero day values, buttimetz_izone(), timestamp_izone(), and timestamptz_izone() evidently wereoverlooked.While at it, make the error messages for these three cases consistent.
1 parentbfb8a8d commit9afc583

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

‎src/backend/utils/adt/date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,10 +2696,10 @@ timetz_izone(PG_FUNCTION_ARGS)
26962696
TimeTzADT*result;
26972697
inttz;
26982698

2699-
if (zone->month!=0)
2699+
if (zone->month!=0||zone->day!=0)
27002700
ereport(ERROR,
27012701
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2702-
errmsg("\"interval\" time zone \"%s\" notvalid",
2702+
errmsg("interval time zone \"%s\"mustnotinclude months or days",
27032703
DatumGetCString(DirectFunctionCall1(interval_out,
27042704
PointerGetDatum(zone))))));
27052705

‎src/backend/utils/adt/timestamp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4604,10 +4604,10 @@ timestamp_izone(PG_FUNCTION_ARGS)
46044604
if (TIMESTAMP_NOT_FINITE(timestamp))
46054605
PG_RETURN_TIMESTAMPTZ(timestamp);
46064606

4607-
if (zone->month!=0)
4607+
if (zone->month!=0||zone->day!=0)
46084608
ereport(ERROR,
46094609
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4610-
errmsg("interval time zone \"%s\" must notspecify month",
4610+
errmsg("interval time zone \"%s\" must notinclude months or days",
46114611
DatumGetCString(DirectFunctionCall1(interval_out,
46124612
PointerGetDatum(zone))))));
46134613

@@ -4777,10 +4777,10 @@ timestamptz_izone(PG_FUNCTION_ARGS)
47774777
if (TIMESTAMP_NOT_FINITE(timestamp))
47784778
PG_RETURN_TIMESTAMP(timestamp);
47794779

4780-
if (zone->month!=0)
4780+
if (zone->month!=0||zone->day!=0)
47814781
ereport(ERROR,
47824782
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4783-
errmsg("interval time zone \"%s\" must notspecify month",
4783+
errmsg("interval time zone \"%s\" must notinclude months or days",
47844784
DatumGetCString(DirectFunctionCall1(interval_out,
47854785
PointerGetDatum(zone))))));
47864786

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp