1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Phase 3 of pgindent updates.

Don't move parenthesized lines to the left, even if that means they
flow past the right margin.

By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis.  However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent.  That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.

This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@ -110,9 +110,9 @@ anytimestamp_typmod_check(bool istz, int32 typmod)
{
ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("TIMESTAMP(%d)%s precision reduced to maximum allowed, %d",
typmod, (istz ? " WITH TIME ZONE" : ""),
MAX_TIMESTAMP_PRECISION)));
errmsg("TIMESTAMP(%d)%s precision reduced to maximum allowed, %d",
typmod, (istz ? " WITH TIME ZONE" : ""),
MAX_TIMESTAMP_PRECISION)));
typmod = MAX_TIMESTAMP_PRECISION;
}
@ -191,7 +191,7 @@ timestamp_in(PG_FUNCTION_ARGS)
case DTK_INVALID:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("date/time value \"%s\" is no longer supported", str)));
errmsg("date/time value \"%s\" is no longer supported", str)));
TIMESTAMP_NOEND(result);
break;
@ -359,8 +359,8 @@ AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
if (typmod < 0 || typmod > MAX_TIMESTAMP_PRECISION)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("timestamp(%d) precision must be between %d and %d",
typmod, 0, MAX_TIMESTAMP_PRECISION)));
errmsg("timestamp(%d) precision must be between %d and %d",
typmod, 0, MAX_TIMESTAMP_PRECISION)));
if (*time >= INT64CONST(0))
{
@ -431,7 +431,7 @@ timestamptz_in(PG_FUNCTION_ARGS)
case DTK_INVALID:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("date/time value \"%s\" is no longer supported", str)));
errmsg("date/time value \"%s\" is no longer supported", str)));
TIMESTAMP_NOEND(result);
break;
@ -496,7 +496,7 @@ parse_sane_timezone(struct pg_tm *tm, text *zone)
if (rt == DTERR_TZDISP_OVERFLOW)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("numeric time zone \"%s\" out of range", tzname)));
errmsg("numeric time zone \"%s\" out of range", tzname)));
else if (rt != DTERR_BAD_FORMAT)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@ -938,7 +938,7 @@ interval_in(PG_FUNCTION_ARGS)
case DTK_INVALID:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("date/time value \"%s\" is no longer supported", str)));
errmsg("date/time value \"%s\" is no longer supported", str)));
break;
default:
@ -1087,8 +1087,8 @@ intervaltypmodin(PG_FUNCTION_ARGS)
{
ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("INTERVAL(%d) precision reduced to maximum allowed, %d",
tl[1], MAX_INTERVAL_PRECISION)));
errmsg("INTERVAL(%d) precision reduced to maximum allowed, %d",
tl[1], MAX_INTERVAL_PRECISION)));
typmod = INTERVAL_TYPMOD(MAX_INTERVAL_PRECISION, tl[0]);
}
else
@ -1459,8 +1459,8 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
if (precision < 0 || precision > MAX_INTERVAL_PRECISION)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("interval(%d) precision must be between %d and %d",
precision, 0, MAX_INTERVAL_PRECISION)));
errmsg("interval(%d) precision must be between %d and %d",
precision, 0, MAX_INTERVAL_PRECISION)));
if (interval->time >= INT64CONST(0))
{
@ -1694,7 +1694,7 @@ timestamptz_to_time_t(TimestampTz t)
pg_time_t result;
result = (pg_time_t) (t / USECS_PER_SEC +
((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY));
((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY));
return result;
}
@ -2625,7 +2625,7 @@ timestamp_mi(PG_FUNCTION_ARGS)
*----------
*/
result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
IntervalPGetDatum(result)));
PG_RETURN_INTERVAL_P(result);
}
@ -3161,7 +3161,7 @@ interval_mul(PG_FUNCTION_ARGS)
month_remainder_days = (orig_month * factor - result->month) * DAYS_PER_MONTH;
month_remainder_days = TSROUND(month_remainder_days);
sec_remainder = (orig_day * factor - result->day +
month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY;
month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY;
sec_remainder = TSROUND(sec_remainder);
/*
@ -3224,7 +3224,7 @@ interval_div(PG_FUNCTION_ARGS)
month_remainder_days = (orig_month / factor - result->month) * DAYS_PER_MONTH;
month_remainder_days = TSROUND(month_remainder_days);
sec_remainder = (orig_day / factor - result->day +
month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY;
month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY;
sec_remainder = TSROUND(sec_remainder);
if (Abs(sec_remainder) >= SECS_PER_DAY)
{
@ -3272,7 +3272,7 @@ interval_accum(PG_FUNCTION_ARGS)
newsum = DatumGetIntervalP(DirectFunctionCall2(interval_pl,
IntervalPGetDatum(&sumX),
IntervalPGetDatum(newval)));
IntervalPGetDatum(newval)));
N.time += 1;
transdatums[0] = IntervalPGetDatum(newsum);
@ -3356,7 +3356,7 @@ interval_accum_inv(PG_FUNCTION_ARGS)
newsum = DatumGetIntervalP(DirectFunctionCall2(interval_mi,
IntervalPGetDatum(&sumX),
IntervalPGetDatum(newval)));
IntervalPGetDatum(newval)));
N.time -= 1;
transdatums[0] = IntervalPGetDatum(newsum);
@ -3911,8 +3911,8 @@ timestamptz_trunc(PG_FUNCTION_ARGS)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("timestamp with time zone units \"%s\" not recognized",
lowunits)));
errmsg("timestamp with time zone units \"%s\" not recognized",
lowunits)));
result = 0;
}
@ -3985,7 +3985,7 @@ interval_trunc(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("interval units \"%s\" not supported "
"because months usually have fractional weeks",
"because months usually have fractional weeks",
lowunits)));
else
ereport(ERROR,
@ -4206,8 +4206,8 @@ NonFiniteTimestampTzPart(int type, int unit, char *lowunits,
if (isTz)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("timestamp with time zone units \"%s\" not recognized",
lowunits)));
errmsg("timestamp with time zone units \"%s\" not recognized",
lowunits)));
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@ -4252,8 +4252,8 @@ NonFiniteTimestampTzPart(int type, int unit, char *lowunits,
if (isTz)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("timestamp with time zone units \"%s\" not supported",
lowunits)));
errmsg("timestamp with time zone units \"%s\" not supported",
lowunits)));
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@ -4391,7 +4391,7 @@ timestamp_part(PG_FUNCTION_ARGS)
case DTK_JULIAN:
result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday);
result += ((((tm->tm_hour * MINS_PER_HOUR) + tm->tm_min) * SECS_PER_MINUTE) +
tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY;
tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY;
break;
case DTK_ISOYEAR:
@ -4595,7 +4595,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
case DTK_JULIAN:
result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday);
result += ((((tm->tm_hour * MINS_PER_HOUR) + tm->tm_min) * SECS_PER_MINUTE) +
tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY;
tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY;
break;
case DTK_ISOYEAR:
@ -4625,8 +4625,8 @@ timestamptz_part(PG_FUNCTION_ARGS)
default:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("timestamp with time zone units \"%s\" not supported",
lowunits)));
errmsg("timestamp with time zone units \"%s\" not supported",
lowunits)));
result = 0;
}
@ -4647,8 +4647,8 @@ timestamptz_part(PG_FUNCTION_ARGS)
default:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("timestamp with time zone units \"%s\" not supported",
lowunits)));
errmsg("timestamp with time zone units \"%s\" not supported",
lowunits)));
result = 0;
}
}
@ -4656,8 +4656,8 @@ timestamptz_part(PG_FUNCTION_ARGS)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("timestamp with time zone units \"%s\" not recognized",
lowunits)));
errmsg("timestamp with time zone units \"%s\" not recognized",
lowunits)));
result = 0;
}
@ -4916,9 +4916,9 @@ timestamp_izone(PG_FUNCTION_ARGS)
if (zone->month != 0 || zone->day != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("interval time zone \"%s\" must not include months or days",
DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
errmsg("interval time zone \"%s\" must not include months or days",
DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
tz = zone->time / USECS_PER_SEC;
@ -5113,9 +5113,9 @@ timestamptz_izone(PG_FUNCTION_ARGS)
if (zone->month != 0 || zone->day != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("interval time zone \"%s\" must not include months or days",
DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
errmsg("interval time zone \"%s\" must not include months or days",
DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
tz = -(zone->time / USECS_PER_SEC);
@ -5196,9 +5196,9 @@ generate_series_timestamp(PG_FUNCTION_ARGS)
{
/* increment current in preparation for next iteration */
fctx->current = DatumGetTimestamp(
DirectFunctionCall2(timestamp_pl_interval,
TimestampGetDatum(fctx->current),
PointerGetDatum(&fctx->step)));
DirectFunctionCall2(timestamp_pl_interval,
TimestampGetDatum(fctx->current),
PointerGetDatum(&fctx->step)));
/* do when there is more left to send */
SRF_RETURN_NEXT(funcctx, TimestampGetDatum(result));
@ -5277,9 +5277,9 @@ generate_series_timestamptz(PG_FUNCTION_ARGS)
{
/* increment current in preparation for next iteration */
fctx->current = DatumGetTimestampTz(
DirectFunctionCall2(timestamptz_pl_interval,
TimestampTzGetDatum(fctx->current),
PointerGetDatum(&fctx->step)));
DirectFunctionCall2(timestamptz_pl_interval,
TimestampTzGetDatum(fctx->current),
PointerGetDatum(&fctx->step)));
/* do when there is more left to send */
SRF_RETURN_NEXT(funcctx, TimestampTzGetDatum(result));