public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] WIP: Deconflict datetime.h macro names.
24+ messages / 4 participants
[nested] [flat]
* [PATCH] WIP: Deconflict datetime.h macro names.
@ 2018-01-26 06:06 Andres Freund <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Andres Freund @ 2018-01-26 06:06 UTC (permalink / raw)
Author: Andres Freund
Discussion: https://www.postgresql.org/message-id/[email protected]
---
contrib/adminpack/adminpack.c | 8 +-
src/backend/parser/gram.y | 52 ++--
src/backend/utils/adt/date.c | 50 +--
src/backend/utils/adt/datetime.c | 614 ++++++++++++++++++-------------------
src/backend/utils/adt/formatting.c | 10 +-
src/backend/utils/adt/json.c | 8 +-
src/backend/utils/adt/nabstime.c | 32 +-
src/backend/utils/adt/timestamp.c | 196 ++++++------
src/backend/utils/adt/xml.c | 6 +-
src/backend/utils/misc/tzparser.c | 4 +-
src/bin/pg_waldump/compat.c | 6 +-
src/include/utils/datetime.h | 216 ++++++-------
12 files changed, 601 insertions(+), 601 deletions(-)
diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c
index 1785dee3a10..39fafebe78e 100644
--- a/contrib/adminpack/adminpack.c
+++ b/contrib/adminpack/adminpack.c
@@ -334,11 +334,11 @@ pg_logdir_ls(PG_FUNCTION_ARGS)
char *values[2];
HeapTuple tuple;
char timestampbuf[32];
- char *field[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
+ char *field[DT_MAXDATEFIELDS];
+ char lowstr[DT_MAXDATELEN + 1];
int dtype;
int nf,
- ftype[MAXDATEFIELDS];
+ ftype[DT_MAXDATEFIELDS];
fsec_t fsec;
int tz = 0;
struct pg_tm date;
@@ -357,7 +357,7 @@ pg_logdir_ls(PG_FUNCTION_ARGS)
timestampbuf[17] = '\0';
/* parse and decode expected timestamp to verify it's OK format */
- if (ParseDateTime(timestampbuf, lowstr, MAXDATELEN, field, ftype, MAXDATEFIELDS, &nf))
+ if (ParseDateTime(timestampbuf, lowstr, DT_MAXDATELEN, field, ftype, DT_MAXDATEFIELDS, &nf))
continue;
if (DecodeDateTime(field, ftype, nf, &dtype, &date, &fsec, &tz))
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 5329432f25c..2834e5bafa4 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -1608,7 +1608,7 @@ zone_value:
if ($3 != NIL)
{
A_Const *n = (A_Const *) linitial($3);
- if ((n->val.val.ival & ~(INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE))) != 0)
+ if ((n->val.val.ival & ~(INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE))) != 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("time zone interval must be HOUR or HOUR TO MINUTE"),
@@ -12772,58 +12772,58 @@ opt_timezone:
opt_interval:
YEAR_P
- { $$ = list_make1(makeIntConst(INTERVAL_MASK(YEAR), @1)); }
+ { $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_YEAR), @1)); }
| MONTH_P
- { $$ = list_make1(makeIntConst(INTERVAL_MASK(MONTH), @1)); }
+ { $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_MONTH), @1)); }
| DAY_P
- { $$ = list_make1(makeIntConst(INTERVAL_MASK(DAY), @1)); }
+ { $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_DAY), @1)); }
| HOUR_P
- { $$ = list_make1(makeIntConst(INTERVAL_MASK(HOUR), @1)); }
+ { $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_HOUR), @1)); }
| MINUTE_P
- { $$ = list_make1(makeIntConst(INTERVAL_MASK(MINUTE), @1)); }
+ { $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_MINUTE), @1)); }
| interval_second
{ $$ = $1; }
| YEAR_P TO MONTH_P
{
- $$ = list_make1(makeIntConst(INTERVAL_MASK(YEAR) |
- INTERVAL_MASK(MONTH), @1));
+ $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_YEAR) |
+ INTERVAL_MASK(DT_MONTH), @1));
}
| DAY_P TO HOUR_P
{
- $$ = list_make1(makeIntConst(INTERVAL_MASK(DAY) |
- INTERVAL_MASK(HOUR), @1));
+ $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_DAY) |
+ INTERVAL_MASK(DT_HOUR), @1));
}
| DAY_P TO MINUTE_P
{
- $$ = list_make1(makeIntConst(INTERVAL_MASK(DAY) |
- INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE), @1));
+ $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_DAY) |
+ INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE), @1));
}
| DAY_P TO interval_second
{
$$ = $3;
- linitial($$) = makeIntConst(INTERVAL_MASK(DAY) |
- INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE) |
- INTERVAL_MASK(SECOND), @1);
+ linitial($$) = makeIntConst(INTERVAL_MASK(DT_DAY) |
+ INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE) |
+ INTERVAL_MASK(DT_SECOND), @1);
}
| HOUR_P TO MINUTE_P
{
- $$ = list_make1(makeIntConst(INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE), @1));
+ $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE), @1));
}
| HOUR_P TO interval_second
{
$$ = $3;
- linitial($$) = makeIntConst(INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE) |
- INTERVAL_MASK(SECOND), @1);
+ linitial($$) = makeIntConst(INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE) |
+ INTERVAL_MASK(DT_SECOND), @1);
}
| MINUTE_P TO interval_second
{
$$ = $3;
- linitial($$) = makeIntConst(INTERVAL_MASK(MINUTE) |
- INTERVAL_MASK(SECOND), @1);
+ linitial($$) = makeIntConst(INTERVAL_MASK(DT_MINUTE) |
+ INTERVAL_MASK(DT_SECOND), @1);
}
| /*EMPTY*/
{ $$ = NIL; }
@@ -12832,11 +12832,11 @@ opt_interval:
interval_second:
SECOND_P
{
- $$ = list_make1(makeIntConst(INTERVAL_MASK(SECOND), @1));
+ $$ = list_make1(makeIntConst(INTERVAL_MASK(DT_SECOND), @1));
}
| SECOND_P '(' Iconst ')'
{
- $$ = list_make2(makeIntConst(INTERVAL_MASK(SECOND), @1),
+ $$ = list_make2(makeIntConst(INTERVAL_MASK(DT_SECOND), @1),
makeIntConst($3, @3));
}
;
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 747ef497897..764c1c89c9b 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -122,12 +122,12 @@ date_in(PG_FUNCTION_ARGS)
int dtype;
int nf;
int dterr;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
- char workbuf[MAXDATELEN + 1];
+ char *field[DT_MAXDATEFIELDS];
+ int ftype[DT_MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + 1];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp);
if (dterr != 0)
@@ -190,7 +190,7 @@ date_out(PG_FUNCTION_ARGS)
char *result;
struct pg_tm tt,
*tm = &tt;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
if (DATE_NOT_FINITE(date))
EncodeSpecialDate(date, buf);
@@ -297,9 +297,9 @@ void
EncodeSpecialDate(DateADT dt, char *str)
{
if (DATE_IS_NOBEGIN(dt))
- strcpy(str, EARLY);
+ strcpy(str, DT_EARLY);
else if (DATE_IS_NOEND(dt))
- strcpy(str, LATE);
+ strcpy(str, DT_LATE);
else /* shouldn't happen */
elog(ERROR, "invalid argument for EncodeSpecialDate");
}
@@ -1211,13 +1211,13 @@ time_in(PG_FUNCTION_ARGS)
int tz;
int nf;
int dterr;
- char workbuf[MAXDATELEN + 1];
- char *field[MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + 1];
+ char *field[DT_MAXDATEFIELDS];
int dtype;
- int ftype[MAXDATEFIELDS];
+ int ftype[DT_MAXDATEFIELDS];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeTimeOnly(field, ftype, nf, &dtype, tm, &fsec, &tz);
if (dterr != 0)
@@ -1268,7 +1268,7 @@ time_out(PG_FUNCTION_ARGS)
struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
time2tm(time, tm, &fsec);
EncodeTimeOnly(tm, fsec, false, 0, DateStyle, buf);
@@ -1861,10 +1861,10 @@ time_part(PG_FUNCTION_ARGS)
false);
type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(0, lowunits, &val);
- if (type == UNITS)
+ if (type == DT_UNITS)
{
fsec_t fsec;
struct pg_tm tt,
@@ -1913,7 +1913,7 @@ time_part(PG_FUNCTION_ARGS)
result = 0;
}
}
- else if (type == RESERV && val == DTK_EPOCH)
+ else if (type == DT_RESERV && val == DTK_EPOCH)
{
result = time / 1000000.0;
}
@@ -1963,13 +1963,13 @@ timetz_in(PG_FUNCTION_ARGS)
int tz;
int nf;
int dterr;
- char workbuf[MAXDATELEN + 1];
- char *field[MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + 1];
+ char *field[DT_MAXDATEFIELDS];
int dtype;
- int ftype[MAXDATEFIELDS];
+ int ftype[DT_MAXDATEFIELDS];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeTimeOnly(field, ftype, nf, &dtype, tm, &fsec, &tz);
if (dterr != 0)
@@ -1991,7 +1991,7 @@ timetz_out(PG_FUNCTION_ARGS)
*tm = &tt;
fsec_t fsec;
int tz;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
timetz2tm(time, tm, &fsec, &tz);
EncodeTimeOnly(tm, fsec, true, tz, DateStyle, buf);
@@ -2558,10 +2558,10 @@ timetz_part(PG_FUNCTION_ARGS)
false);
type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(0, lowunits, &val);
- if (type == UNITS)
+ if (type == DT_UNITS)
{
double dummy;
int tz;
@@ -2623,7 +2623,7 @@ timetz_part(PG_FUNCTION_ARGS)
result = 0;
}
}
- else if (type == RESERV && val == DTK_EPOCH)
+ else if (type == DT_RESERV && val == DTK_EPOCH)
{
result = time->time / 1000000.0 + time->zone;
}
@@ -2673,12 +2673,12 @@ timetz_zone(PG_FUNCTION_ARGS)
type = DecodeTimezoneAbbrev(0, lowzone, &val, &tzp);
- if (type == TZ || type == DTZ)
+ if (type == DT_TZ || type == DT_DTZ)
{
/* fixed-offset abbreviation */
tz = -val;
}
- else if (type == DYNTZ)
+ else if (type == DT_DYNTZ)
{
/* dynamic-offset abbreviation, resolve using current time */
pg_time_t now = (pg_time_t) time(NULL);
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 8375b93c397..7f577784d67 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -89,80 +89,80 @@ const char *const days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
*/
static const datetkn datetktbl[] = {
/* token, type, value */
- {EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */
- {DA_D, ADBC, AD}, /* "ad" for years > 0 */
- {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
- {"am", AMPM, AM},
- {"apr", MONTH, 4},
- {"april", MONTH, 4},
- {"at", IGNORE_DTF, 0}, /* "at" (throwaway) */
- {"aug", MONTH, 8},
- {"august", MONTH, 8},
- {DB_C, ADBC, BC}, /* "bc" for years <= 0 */
- {DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */
- {"d", UNITS, DTK_DAY}, /* "day of month" for ISO input */
- {"dec", MONTH, 12},
- {"december", MONTH, 12},
- {"dow", UNITS, DTK_DOW}, /* day of week */
- {"doy", UNITS, DTK_DOY}, /* day of year */
- {"dst", DTZMOD, SECS_PER_HOUR},
- {EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
- {"feb", MONTH, 2},
- {"february", MONTH, 2},
- {"fri", DOW, 5},
- {"friday", DOW, 5},
- {"h", UNITS, DTK_HOUR}, /* "hour" */
- {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
- {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */
- {"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */
- {"isoyear", UNITS, DTK_ISOYEAR}, /* year in terms of the ISO week date */
- {"j", UNITS, DTK_JULIAN},
- {"jan", MONTH, 1},
- {"january", MONTH, 1},
- {"jd", UNITS, DTK_JULIAN},
- {"jul", MONTH, 7},
- {"julian", UNITS, DTK_JULIAN},
- {"july", MONTH, 7},
- {"jun", MONTH, 6},
- {"june", MONTH, 6},
- {"m", UNITS, DTK_MONTH}, /* "month" for ISO input */
- {"mar", MONTH, 3},
- {"march", MONTH, 3},
- {"may", MONTH, 5},
- {"mm", UNITS, DTK_MINUTE}, /* "minute" for ISO input */
- {"mon", DOW, 1},
- {"monday", DOW, 1},
- {"nov", MONTH, 11},
- {"november", MONTH, 11},
- {NOW, RESERV, DTK_NOW}, /* current transaction time */
- {"oct", MONTH, 10},
- {"october", MONTH, 10},
- {"on", IGNORE_DTF, 0}, /* "on" (throwaway) */
- {"pm", AMPM, PM},
- {"s", UNITS, DTK_SECOND}, /* "seconds" for ISO input */
- {"sat", DOW, 6},
- {"saturday", DOW, 6},
- {"sep", MONTH, 9},
- {"sept", MONTH, 9},
- {"september", MONTH, 9},
- {"sun", DOW, 0},
- {"sunday", DOW, 0},
- {"t", ISOTIME, DTK_TIME}, /* Filler for ISO time fields */
- {"thu", DOW, 4},
- {"thur", DOW, 4},
- {"thurs", DOW, 4},
- {"thursday", DOW, 4},
- {TODAY, RESERV, DTK_TODAY}, /* midnight */
- {TOMORROW, RESERV, DTK_TOMORROW}, /* tomorrow midnight */
- {"tue", DOW, 2},
- {"tues", DOW, 2},
- {"tuesday", DOW, 2},
- {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
- {"wed", DOW, 3},
- {"wednesday", DOW, 3},
- {"weds", DOW, 3},
- {"y", UNITS, DTK_YEAR}, /* "year" for ISO input */
- {YESTERDAY, RESERV, DTK_YESTERDAY} /* yesterday midnight */
+ {DT_EARLY, DT_RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */
+ {DT_DA_D, DT_ADBC, DT_AD}, /* "ad" for years > 0 */
+ {"allballs", DT_RESERV, DTK_ZULU}, /* 00:00:00 */
+ {"am", DT_AMPM, DT_AM},
+ {"apr", DT_MONTH, 4},
+ {"april", DT_MONTH, 4},
+ {"at", DT_IGNORE_DTF, 0}, /* "at" (throwaway) */
+ {"aug", DT_MONTH, 8},
+ {"august", DT_MONTH, 8},
+ {DT_DB_C, DT_ADBC, DT_BC}, /* "bc" for years <= 0 */
+ {DT_DCURRENT, DT_RESERV, DTK_CURRENT}, /* "current" is always now */
+ {"d", DT_UNITS, DTK_DAY}, /* "day of month" for ISO input */
+ {"dec", DT_MONTH, 12},
+ {"december", DT_MONTH, 12},
+ {"dow", DT_UNITS, DTK_DOW}, /* day of week */
+ {"doy", DT_UNITS, DTK_DOY}, /* day of year */
+ {"dst", DT_ZMOD, SECS_PER_HOUR},
+ {DT_EPOCH, DT_RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
+ {"feb", DT_MONTH, 2},
+ {"february", DT_MONTH, 2},
+ {"fri", DT_DOW, 5},
+ {"friday", DT_DOW, 5},
+ {"h", DT_UNITS, DTK_HOUR}, /* "hour" */
+ {DT_LATE, DT_RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
+ {DT_INVALID, DT_RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */
+ {"isodow", DT_UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */
+ {"isoyear", DT_UNITS, DTK_ISOYEAR}, /* year in terms of the ISO week date */
+ {"j", DT_UNITS, DTK_JULIAN},
+ {"jan", DT_MONTH, 1},
+ {"january", DT_MONTH, 1},
+ {"jd", DT_UNITS, DTK_JULIAN},
+ {"jul", DT_MONTH, 7},
+ {"julian", DT_UNITS, DTK_JULIAN},
+ {"july", DT_MONTH, 7},
+ {"jun", DT_MONTH, 6},
+ {"june", DT_MONTH, 6},
+ {"m", DT_UNITS, DTK_MONTH}, /* "month" for ISO input */
+ {"mar", DT_MONTH, 3},
+ {"march", DT_MONTH, 3},
+ {"may", DT_MONTH, 5},
+ {"mm", DT_UNITS, DTK_MINUTE}, /* "minute" for ISO input */
+ {"mon", DT_DOW, 1},
+ {"monday", DT_DOW, 1},
+ {"nov", DT_MONTH, 11},
+ {"november", DT_MONTH, 11},
+ {DT_NOW, DT_RESERV, DTK_NOW}, /* current transaction time */
+ {"oct", DT_MONTH, 10},
+ {"october", DT_MONTH, 10},
+ {"on", DT_IGNORE_DTF, 0}, /* "on" (throwaway) */
+ {"pm", DT_AMPM, DT_PM},
+ {"s", DT_UNITS, DTK_SECOND}, /* "seconds" for ISO input */
+ {"sat", DT_DOW, 6},
+ {"saturday", DT_DOW, 6},
+ {"sep", DT_MONTH, 9},
+ {"sept", DT_MONTH, 9},
+ {"september", DT_MONTH, 9},
+ {"sun", DT_DOW, 0},
+ {"sunday", DT_DOW, 0},
+ {"t", DT_ISOTIME, DTK_TIME}, /* Filler for ISO time fields */
+ {"thu", DT_DOW, 4},
+ {"thur", DT_DOW, 4},
+ {"thurs", DT_DOW, 4},
+ {"thursday", DT_DOW, 4},
+ {DT_TODAY, DT_RESERV, DTK_TODAY}, /* midnight */
+ {DT_TOMORROW, DT_RESERV, DTK_TOMORROW}, /* tomorrow midnight */
+ {"tue", DT_DOW, 2},
+ {"tues", DT_DOW, 2},
+ {"tuesday", DT_DOW, 2},
+ {"undefined", DT_RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
+ {"wed", DT_DOW, 3},
+ {"wednesday", DT_DOW, 3},
+ {"weds", DT_DOW, 3},
+ {"y", DT_UNITS, DTK_YEAR}, /* "year" for ISO input */
+ {DT_YESTERDAY, DT_RESERV, DTK_YESTERDAY} /* yesterday midnight */
};
static int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0];
@@ -173,69 +173,69 @@ static int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0];
*/
static const datetkn deltatktbl[] = {
/* token, type, value */
- {"@", IGNORE_DTF, 0}, /* postgres relative prefix */
- {DAGO, AGO, 0}, /* "ago" indicates negative time offset */
- {"c", UNITS, DTK_CENTURY}, /* "century" relative */
- {"cent", UNITS, DTK_CENTURY}, /* "century" relative */
- {"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative */
- {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */
- {"d", UNITS, DTK_DAY}, /* "day" relative */
- {DDAY, UNITS, DTK_DAY}, /* "day" relative */
- {"days", UNITS, DTK_DAY}, /* "days" relative */
- {"dec", UNITS, DTK_DECADE}, /* "decade" relative */
- {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */
- {"decades", UNITS, DTK_DECADE}, /* "decades" relative */
- {"decs", UNITS, DTK_DECADE}, /* "decades" relative */
- {"h", UNITS, DTK_HOUR}, /* "hour" relative */
- {DHOUR, UNITS, DTK_HOUR}, /* "hour" relative */
- {"hours", UNITS, DTK_HOUR}, /* "hours" relative */
- {"hr", UNITS, DTK_HOUR}, /* "hour" relative */
- {"hrs", UNITS, DTK_HOUR}, /* "hours" relative */
- {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */
- {"m", UNITS, DTK_MINUTE}, /* "minute" relative */
- {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
- {"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
- {"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
- {DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
- {"millisecon", UNITS, DTK_MILLISEC}, /* relative */
- {"mils", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
- {"min", UNITS, DTK_MINUTE}, /* "minute" relative */
- {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative */
- {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */
- {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */
- {"mon", UNITS, DTK_MONTH}, /* "months" relative */
- {"mons", UNITS, DTK_MONTH}, /* "months" relative */
- {DMONTH, UNITS, DTK_MONTH}, /* "month" relative */
- {"months", UNITS, DTK_MONTH},
- {"ms", UNITS, DTK_MILLISEC},
- {"msec", UNITS, DTK_MILLISEC},
- {DMILLISEC, UNITS, DTK_MILLISEC},
- {"mseconds", UNITS, DTK_MILLISEC},
- {"msecs", UNITS, DTK_MILLISEC},
- {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */
- {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */
- {"s", UNITS, DTK_SECOND},
- {"sec", UNITS, DTK_SECOND},
- {DSECOND, UNITS, DTK_SECOND},
- {"seconds", UNITS, DTK_SECOND},
- {"secs", UNITS, DTK_SECOND},
- {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
- {"timezone_h", UNITS, DTK_TZ_HOUR}, /* timezone hour units */
- {"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */
- {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
- {"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
- {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */
- {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative */
- {"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative */
- {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */
- {"w", UNITS, DTK_WEEK}, /* "week" relative */
- {DWEEK, UNITS, DTK_WEEK}, /* "week" relative */
- {"weeks", UNITS, DTK_WEEK}, /* "weeks" relative */
- {"y", UNITS, DTK_YEAR}, /* "year" relative */
- {DYEAR, UNITS, DTK_YEAR}, /* "year" relative */
- {"years", UNITS, DTK_YEAR}, /* "years" relative */
- {"yr", UNITS, DTK_YEAR}, /* "year" relative */
- {"yrs", UNITS, DTK_YEAR} /* "years" relative */
+ {"@", DT_IGNORE_DTF, 0}, /* postgres relative prefix */
+ {DT_DAGO, DT_AGO, 0}, /* "ago" indicates negative time offset */
+ {"c", DT_UNITS, DTK_CENTURY}, /* "century" relative */
+ {"cent", DT_UNITS, DTK_CENTURY}, /* "century" relative */
+ {"centuries", DT_UNITS, DTK_CENTURY}, /* "centuries" relative */
+ {DT_DCENTURY, DT_UNITS, DTK_CENTURY}, /* "century" relative */
+ {"d", DT_UNITS, DTK_DAY}, /* "day" relative */
+ {DT_DDAY, DT_UNITS, DTK_DAY}, /* "day" relative */
+ {"days", DT_UNITS, DTK_DAY}, /* "days" relative */
+ {"dec", DT_UNITS, DTK_DECADE}, /* "decade" relative */
+ {DT_DDECADE, DT_UNITS, DTK_DECADE}, /* "decade" relative */
+ {"decades", DT_UNITS, DTK_DECADE}, /* "decades" relative */
+ {"decs", DT_UNITS, DTK_DECADE}, /* "decades" relative */
+ {"h", DT_UNITS, DTK_HOUR}, /* "hour" relative */
+ {DT_DHOUR, DT_UNITS, DTK_HOUR}, /* "hour" relative */
+ {"hours", DT_UNITS, DTK_HOUR}, /* "hours" relative */
+ {"hr", DT_UNITS, DTK_HOUR}, /* "hour" relative */
+ {"hrs", DT_UNITS, DTK_HOUR}, /* "hours" relative */
+ {DT_INVALID, DT_RESERV, DTK_INVALID}, /* reserved for invalid time */
+ {"m", DT_UNITS, DTK_MINUTE}, /* "minute" relative */
+ {"microsecon", DT_UNITS, DTK_MICROSEC}, /* "microsecond" relative */
+ {"mil", DT_UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
+ {"millennia", DT_UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
+ {DT_DMILLENNIUM, DT_UNITS, DTK_MILLENNIUM}, /* "millennium" relative */
+ {"millisecon", DT_UNITS, DTK_MILLISEC}, /* relative */
+ {"mils", DT_UNITS, DTK_MILLENNIUM}, /* "millennia" relative */
+ {"min", DT_UNITS, DTK_MINUTE}, /* "minute" relative */
+ {"mins", DT_UNITS, DTK_MINUTE}, /* "minutes" relative */
+ {DT_DMINUTE, DT_UNITS, DTK_MINUTE}, /* "minute" relative */
+ {"minutes", DT_UNITS, DTK_MINUTE}, /* "minutes" relative */
+ {"mon", DT_UNITS, DTK_MONTH}, /* "months" relative */
+ {"mons", DT_UNITS, DTK_MONTH}, /* "months" relative */
+ {DT_DMONTH, DT_UNITS, DTK_MONTH}, /* "month" relative */
+ {"months", DT_UNITS, DTK_MONTH},
+ {"ms", DT_UNITS, DTK_MILLISEC},
+ {"msec", DT_UNITS, DTK_MILLISEC},
+ {DT_DMILLISEC, DT_UNITS, DTK_MILLISEC},
+ {"mseconds", DT_UNITS, DTK_MILLISEC},
+ {"msecs", DT_UNITS, DTK_MILLISEC},
+ {"qtr", DT_UNITS, DTK_QUARTER}, /* "quarter" relative */
+ {DT_DQUARTER, DT_UNITS, DTK_QUARTER}, /* "quarter" relative */
+ {"s", DT_UNITS, DTK_SECOND},
+ {"sec", DT_UNITS, DTK_SECOND},
+ {DT_DSECOND, DT_UNITS, DTK_SECOND},
+ {"seconds", DT_UNITS, DTK_SECOND},
+ {"secs", DT_UNITS, DTK_SECOND},
+ {DT_DTIMEZONE, DT_UNITS, DTK_TZ}, /* "timezone" time offset */
+ {"timezone_h", DT_UNITS, DTK_TZ_HOUR}, /* timezone hour units */
+ {"timezone_m", DT_UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */
+ {"undefined", DT_RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
+ {"us", DT_UNITS, DTK_MICROSEC}, /* "microsecond" relative */
+ {"usec", DT_UNITS, DTK_MICROSEC}, /* "microsecond" relative */
+ {DT_DMICROSEC, DT_UNITS, DTK_MICROSEC}, /* "microsecond" relative */
+ {"useconds", DT_UNITS, DTK_MICROSEC}, /* "microseconds" relative */
+ {"usecs", DT_UNITS, DTK_MICROSEC}, /* "microseconds" relative */
+ {"w", DT_UNITS, DTK_WEEK}, /* "week" relative */
+ {DT_DWEEK, DT_UNITS, DTK_WEEK}, /* "week" relative */
+ {"weeks", DT_UNITS, DTK_WEEK}, /* "weeks" relative */
+ {"y", DT_UNITS, DTK_YEAR}, /* "year" relative */
+ {DT_DYEAR, DT_UNITS, DTK_YEAR}, /* "year" relative */
+ {"years", DT_UNITS, DTK_YEAR}, /* "years" relative */
+ {"yr", DT_UNITS, DTK_YEAR}, /* "year" relative */
+ {"yrs", DT_UNITS, DTK_YEAR} /* "years" relative */
};
static int szdeltatktbl = sizeof deltatktbl / sizeof deltatktbl[0];
@@ -244,11 +244,11 @@ static TimeZoneAbbrevTable *zoneabbrevtbl = NULL;
/* Caches of recent lookup results in the above tables */
-static const datetkn *datecache[MAXDATEFIELDS] = {NULL};
+static const datetkn *datecache[DT_MAXDATEFIELDS] = {NULL};
-static const datetkn *deltacache[MAXDATEFIELDS] = {NULL};
+static const datetkn *deltacache[DT_MAXDATEFIELDS] = {NULL};
-static const datetkn *abbrevcache[MAXDATEFIELDS] = {NULL};
+static const datetkn *abbrevcache[DT_MAXDATEFIELDS] = {NULL};
/*
@@ -790,7 +790,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
int i;
int val;
int dterr;
- int mer = HR24;
+ int mer = DT_HR24;
bool haveTextMonth = false;
bool isjulian = false;
bool is2digits = false;
@@ -847,7 +847,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (dterr)
return dterr;
- tmask = DTK_DATE_M | DTK_TIME_M | DTK_M(TZ);
+ tmask = DTK_DATE_M | DTK_TIME_M | DTK_M(DT_TZ);
ptype = 0;
break;
}
@@ -863,8 +863,8 @@ DecodeDateTime(char **field, int *ftype, int nf,
* we've historically accepted.
*/
else if (ptype != 0 ||
- ((fmask & (DTK_M(MONTH) | DTK_M(DAY))) ==
- (DTK_M(MONTH) | DTK_M(DAY))))
+ ((fmask & (DTK_M(DT_MONTH) | DTK_M(DT_DAY))) ==
+ (DTK_M(DT_MONTH) | DTK_M(DT_DAY))))
{
/* No time zone accepted? Then quit... */
if (tzp == NULL)
@@ -914,7 +914,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
* modify tmask after returning from
* DecodeNumberField()
*/
- tmask |= DTK_M(TZ);
+ tmask |= DTK_M(DT_TZ);
}
else
{
@@ -932,7 +932,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
field[i])));
}
/* we'll apply the zone setting below */
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
}
}
else
@@ -983,7 +983,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (dterr)
return dterr;
*tzp = tz;
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
}
break;
@@ -1025,7 +1025,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
{
case DTK_YEAR:
tm->tm_year = val;
- tmask = DTK_M(YEAR);
+ tmask = DTK_M(DT_YEAR);
break;
case DTK_MONTH:
@@ -1034,37 +1034,37 @@ DecodeDateTime(char **field, int *ftype, int nf,
* already have a month and hour? then assume
* minutes
*/
- if ((fmask & DTK_M(MONTH)) != 0 &&
- (fmask & DTK_M(HOUR)) != 0)
+ if ((fmask & DTK_M(DT_MONTH)) != 0 &&
+ (fmask & DTK_M(DT_HOUR)) != 0)
{
tm->tm_min = val;
- tmask = DTK_M(MINUTE);
+ tmask = DTK_M(DT_MINUTE);
}
else
{
tm->tm_mon = val;
- tmask = DTK_M(MONTH);
+ tmask = DTK_M(DT_MONTH);
}
break;
case DTK_DAY:
tm->tm_mday = val;
- tmask = DTK_M(DAY);
+ tmask = DTK_M(DT_DAY);
break;
case DTK_HOUR:
tm->tm_hour = val;
- tmask = DTK_M(HOUR);
+ tmask = DTK_M(DT_HOUR);
break;
case DTK_MINUTE:
tm->tm_min = val;
- tmask = DTK_M(MINUTE);
+ tmask = DTK_M(DT_MINUTE);
break;
case DTK_SECOND:
tm->tm_sec = val;
- tmask = DTK_M(SECOND);
+ tmask = DTK_M(DT_SECOND);
if (*cp == '.')
{
dterr = ParseFractionalSecond(cp, fsec);
@@ -1075,7 +1075,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
break;
case DTK_TZ:
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
dterr = DecodeTimezone(field[i], tzp);
if (dterr)
return dterr;
@@ -1192,15 +1192,15 @@ DecodeDateTime(char **field, int *ftype, int nf,
case DTK_SPECIAL:
/* timezone abbrevs take precedence over built-in tokens */
type = DecodeTimezoneAbbrev(i, field[i], &val, &valtz);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(i, field[i], &val);
- if (type == IGNORE_DTF)
+ if (type == DT_IGNORE_DTF)
continue;
tmask = DTK_M(type);
switch (type)
{
- case RESERV:
+ case DT_RESERV:
switch (val)
{
case DTK_CURRENT:
@@ -1212,7 +1212,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
break;
case DTK_NOW:
- tmask = (DTK_DATE_M | DTK_TIME_M | DTK_M(TZ));
+ tmask = (DTK_DATE_M | DTK_TIME_M | DTK_M(DT_TZ));
*dtype = DTK_DATE;
GetCurrentTimeUsec(tm, fsec, tzp);
break;
@@ -1243,7 +1243,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
break;
case DTK_ZULU:
- tmask = (DTK_TIME_M | DTK_M(TZ));
+ tmask = (DTK_TIME_M | DTK_M(DT_TZ));
*dtype = DTK_DATE;
tm->tm_hour = 0;
tm->tm_min = 0;
@@ -1258,58 +1258,58 @@ DecodeDateTime(char **field, int *ftype, int nf,
break;
- case MONTH:
+ case DT_MONTH:
/*
* already have a (numeric) month? then see if we can
* substitute...
*/
- if ((fmask & DTK_M(MONTH)) && !haveTextMonth &&
- !(fmask & DTK_M(DAY)) && tm->tm_mon >= 1 &&
+ if ((fmask & DTK_M(DT_MONTH)) && !haveTextMonth &&
+ !(fmask & DTK_M(DT_DAY)) && tm->tm_mon >= 1 &&
tm->tm_mon <= 31)
{
tm->tm_mday = tm->tm_mon;
- tmask = DTK_M(DAY);
+ tmask = DTK_M(DT_DAY);
}
haveTextMonth = true;
tm->tm_mon = val;
break;
- case DTZMOD:
+ case DT_ZMOD:
/*
* daylight savings time modifier (solves "MET DST"
* syntax)
*/
- tmask |= DTK_M(DTZ);
+ tmask |= DTK_M(DT_DTZ);
tm->tm_isdst = 1;
if (tzp == NULL)
return DTERR_BAD_FORMAT;
*tzp -= val;
break;
- case DTZ:
+ case DT_DTZ:
/*
* set mask for TZ here _or_ check for DTZ later when
* getting default timezone
*/
- tmask |= DTK_M(TZ);
+ tmask |= DTK_M(DT_TZ);
tm->tm_isdst = 1;
if (tzp == NULL)
return DTERR_BAD_FORMAT;
*tzp = -val;
break;
- case TZ:
+ case DT_TZ:
tm->tm_isdst = 0;
if (tzp == NULL)
return DTERR_BAD_FORMAT;
*tzp = -val;
break;
- case DYNTZ:
- tmask |= DTK_M(TZ);
+ case DT_DYNTZ:
+ tmask |= DTK_M(DT_TZ);
if (tzp == NULL)
return DTERR_BAD_FORMAT;
/* we'll determine the actual offset later */
@@ -1317,24 +1317,24 @@ DecodeDateTime(char **field, int *ftype, int nf,
abbrev = field[i];
break;
- case AMPM:
+ case DT_AMPM:
mer = val;
break;
- case ADBC:
- bc = (val == BC);
+ case DT_ADBC:
+ bc = (val == DT_BC);
break;
- case DOW:
+ case DT_DOW:
tm->tm_wday = val;
break;
- case UNITS:
+ case DT_UNITS:
tmask = 0;
ptype = val;
break;
- case ISOTIME:
+ case DT_ISOTIME:
/*
* This is a filler field "t" indicating that the next
@@ -1361,7 +1361,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
ptype = val;
break;
- case UNKNOWN_FIELD:
+ case DT_UNKNOWN_FIELD:
/*
* Before giving up and declaring error, check to see
@@ -1371,7 +1371,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (!namedTz)
return DTERR_BAD_FORMAT;
/* we'll apply the zone setting below */
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
break;
default:
@@ -1394,11 +1394,11 @@ DecodeDateTime(char **field, int *ftype, int nf,
return dterr;
/* handle AM/PM */
- if (mer != HR24 && tm->tm_hour > HOURS_PER_DAY / 2)
+ if (mer != DT_HR24 && tm->tm_hour > HOURS_PER_DAY / 2)
return DTERR_FIELD_OVERFLOW;
- if (mer == AM && tm->tm_hour == HOURS_PER_DAY / 2)
+ if (mer == DT_AM && tm->tm_hour == HOURS_PER_DAY / 2)
tm->tm_hour = 0;
- else if (mer == PM && tm->tm_hour != HOURS_PER_DAY / 2)
+ else if (mer == DT_PM && tm->tm_hour != HOURS_PER_DAY / 2)
tm->tm_hour += HOURS_PER_DAY / 2;
/* do additional checking for full date specs... */
@@ -1418,7 +1418,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (namedTz != NULL)
{
/* daylight savings time modifier disallowed with full TZ */
- if (fmask & DTK_M(DTZMOD))
+ if (fmask & DTK_M(DT_ZMOD))
return DTERR_BAD_FORMAT;
*tzp = DetermineTimeZoneOffset(tm, namedTz);
@@ -1431,20 +1431,20 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (abbrevTz != NULL)
{
/* daylight savings time modifier disallowed with dynamic TZ */
- if (fmask & DTK_M(DTZMOD))
+ if (fmask & DTK_M(DT_ZMOD))
return DTERR_BAD_FORMAT;
*tzp = DetermineTimeZoneAbbrevOffset(tm, abbrev, abbrevTz);
}
/* timezone not specified? then use session timezone */
- if (tzp != NULL && !(fmask & DTK_M(TZ)))
+ if (tzp != NULL && !(fmask & DTK_M(DT_TZ)))
{
/*
* daylight savings time modifier but no standard timezone? then
* error
*/
- if (fmask & DTK_M(DTZMOD))
+ if (fmask & DTK_M(DT_ZMOD))
return DTERR_BAD_FORMAT;
*tzp = DetermineTimeZoneOffset(tm, session_timezone);
@@ -1754,7 +1754,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
bool isjulian = false;
bool is2digits = false;
bool bc = false;
- int mer = HR24;
+ int mer = DT_HR24;
pg_tz *namedTz = NULL;
pg_tz *abbrevTz = NULL;
char *abbrev = NULL;
@@ -1831,7 +1831,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
return dterr;
ftype[i] = dterr;
- tmask |= DTK_M(TZ);
+ tmask |= DTK_M(DT_TZ);
}
else
{
@@ -1850,7 +1850,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
}
/* we'll apply the zone setting below */
ftype[i] = DTK_TZ;
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
}
}
break;
@@ -1874,7 +1874,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
if (dterr)
return dterr;
*tzp = tz;
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
}
break;
@@ -1929,7 +1929,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
{
case DTK_YEAR:
tm->tm_year = val;
- tmask = DTK_M(YEAR);
+ tmask = DTK_M(DT_YEAR);
break;
case DTK_MONTH:
@@ -1938,37 +1938,37 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
* already have a month and hour? then assume
* minutes
*/
- if ((fmask & DTK_M(MONTH)) != 0 &&
- (fmask & DTK_M(HOUR)) != 0)
+ if ((fmask & DTK_M(DT_MONTH)) != 0 &&
+ (fmask & DTK_M(DT_HOUR)) != 0)
{
tm->tm_min = val;
- tmask = DTK_M(MINUTE);
+ tmask = DTK_M(DT_MINUTE);
}
else
{
tm->tm_mon = val;
- tmask = DTK_M(MONTH);
+ tmask = DTK_M(DT_MONTH);
}
break;
case DTK_DAY:
tm->tm_mday = val;
- tmask = DTK_M(DAY);
+ tmask = DTK_M(DT_DAY);
break;
case DTK_HOUR:
tm->tm_hour = val;
- tmask = DTK_M(HOUR);
+ tmask = DTK_M(DT_HOUR);
break;
case DTK_MINUTE:
tm->tm_min = val;
- tmask = DTK_M(MINUTE);
+ tmask = DTK_M(DT_MINUTE);
break;
case DTK_SECOND:
tm->tm_sec = val;
- tmask = DTK_M(SECOND);
+ tmask = DTK_M(DT_SECOND);
if (*cp == '.')
{
dterr = ParseFractionalSecond(cp, fsec);
@@ -1979,7 +1979,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
break;
case DTK_TZ:
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
dterr = DecodeTimezone(field[i], tzp);
if (dterr)
return dterr;
@@ -2100,15 +2100,15 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
case DTK_SPECIAL:
/* timezone abbrevs take precedence over built-in tokens */
type = DecodeTimezoneAbbrev(i, field[i], &val, &valtz);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(i, field[i], &val);
- if (type == IGNORE_DTF)
+ if (type == DT_IGNORE_DTF)
continue;
tmask = DTK_M(type);
switch (type)
{
- case RESERV:
+ case DT_RESERV:
switch (val)
{
case DTK_CURRENT:
@@ -2125,7 +2125,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
break;
case DTK_ZULU:
- tmask = (DTK_TIME_M | DTK_M(TZ));
+ tmask = (DTK_TIME_M | DTK_M(DT_TZ));
*dtype = DTK_TIME;
tm->tm_hour = 0;
tm->tm_min = 0;
@@ -2139,26 +2139,26 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
break;
- case DTZMOD:
+ case DT_ZMOD:
/*
* daylight savings time modifier (solves "MET DST"
* syntax)
*/
- tmask |= DTK_M(DTZ);
+ tmask |= DTK_M(DT_DTZ);
tm->tm_isdst = 1;
if (tzp == NULL)
return DTERR_BAD_FORMAT;
*tzp -= val;
break;
- case DTZ:
+ case DT_DTZ:
/*
* set mask for TZ here _or_ check for DTZ later when
* getting default timezone
*/
- tmask |= DTK_M(TZ);
+ tmask |= DTK_M(DT_TZ);
tm->tm_isdst = 1;
if (tzp == NULL)
return DTERR_BAD_FORMAT;
@@ -2166,7 +2166,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
ftype[i] = DTK_TZ;
break;
- case TZ:
+ case DT_TZ:
tm->tm_isdst = 0;
if (tzp == NULL)
return DTERR_BAD_FORMAT;
@@ -2174,8 +2174,8 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
ftype[i] = DTK_TZ;
break;
- case DYNTZ:
- tmask |= DTK_M(TZ);
+ case DT_DYNTZ:
+ tmask |= DTK_M(DT_TZ);
if (tzp == NULL)
return DTERR_BAD_FORMAT;
/* we'll determine the actual offset later */
@@ -2184,20 +2184,20 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
ftype[i] = DTK_TZ;
break;
- case AMPM:
+ case DT_AMPM:
mer = val;
break;
- case ADBC:
- bc = (val == BC);
+ case DT_ADBC:
+ bc = (val == DT_BC);
break;
- case UNITS:
+ case DT_UNITS:
tmask = 0;
ptype = val;
break;
- case ISOTIME:
+ case DT_ISOTIME:
tmask = 0;
/***
@@ -2215,7 +2215,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
ptype = val;
break;
- case UNKNOWN_FIELD:
+ case DT_UNKNOWN_FIELD:
/*
* Before giving up and declaring error, check to see
@@ -2225,7 +2225,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
if (!namedTz)
return DTERR_BAD_FORMAT;
/* we'll apply the zone setting below */
- tmask = DTK_M(TZ);
+ tmask = DTK_M(DT_TZ);
break;
default:
@@ -2248,11 +2248,11 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
return dterr;
/* handle AM/PM */
- if (mer != HR24 && tm->tm_hour > HOURS_PER_DAY / 2)
+ if (mer != DT_HR24 && tm->tm_hour > HOURS_PER_DAY / 2)
return DTERR_FIELD_OVERFLOW;
- if (mer == AM && tm->tm_hour == HOURS_PER_DAY / 2)
+ if (mer == DT_AM && tm->tm_hour == HOURS_PER_DAY / 2)
tm->tm_hour = 0;
- else if (mer == PM && tm->tm_hour != HOURS_PER_DAY / 2)
+ else if (mer == DT_PM && tm->tm_hour != HOURS_PER_DAY / 2)
tm->tm_hour += HOURS_PER_DAY / 2;
/*
@@ -2279,7 +2279,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
long int gmtoff;
/* daylight savings time modifier disallowed with full TZ */
- if (fmask & DTK_M(DTZMOD))
+ if (fmask & DTK_M(DT_ZMOD))
return DTERR_BAD_FORMAT;
/* if non-DST zone, we do not need to know the date */
@@ -2307,7 +2307,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
/*
* daylight savings time modifier but no standard timezone? then error
*/
- if (fmask & DTK_M(DTZMOD))
+ if (fmask & DTK_M(DT_ZMOD))
return DTERR_BAD_FORMAT;
if ((fmask & DTK_DATE_M) == 0)
@@ -2326,7 +2326,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
}
/* timezone not specified? then use session timezone */
- if (tzp != NULL && !(fmask & DTK_M(TZ)))
+ if (tzp != NULL && !(fmask & DTK_M(DT_TZ)))
{
struct pg_tm tt,
*tmp = &tt;
@@ -2334,7 +2334,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
/*
* daylight savings time modifier but no standard timezone? then error
*/
- if (fmask & DTK_M(DTZMOD))
+ if (fmask & DTK_M(DT_ZMOD))
return DTERR_BAD_FORMAT;
if ((fmask & DTK_DATE_M) == 0)
@@ -2378,12 +2378,12 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
int type,
val,
dmask = 0;
- char *field[MAXDATEFIELDS];
+ char *field[DT_MAXDATEFIELDS];
*tmask = 0;
/* parse this string... */
- while (*str != '\0' && nf < MAXDATEFIELDS)
+ while (*str != '\0' && nf < DT_MAXDATEFIELDS)
{
/* skip field separators */
while (*str != '\0' && !isalnum((unsigned char) *str))
@@ -2416,13 +2416,13 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
if (isalpha((unsigned char) *field[i]))
{
type = DecodeSpecial(i, field[i], &val);
- if (type == IGNORE_DTF)
+ if (type == DT_IGNORE_DTF)
continue;
dmask = DTK_M(type);
switch (type)
{
- case MONTH:
+ case DT_MONTH:
tm->tm_mon = val;
haveTextMonth = true;
break;
@@ -2463,7 +2463,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
*tmask |= dmask;
}
- if ((fmask & ~(DTK_M(DOY) | DTK_M(TZ))) != DTK_DATE_M)
+ if ((fmask & ~(DTK_M(DT_DOY) | DTK_M(DT_TZ))) != DTK_DATE_M)
return DTERR_BAD_FORMAT;
/* validation of the field values must wait until ValidateDate() */
@@ -2479,7 +2479,7 @@ int
ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc,
struct pg_tm *tm)
{
- if (fmask & DTK_M(YEAR))
+ if (fmask & DTK_M(DT_YEAR))
{
if (isjulian)
{
@@ -2512,21 +2512,21 @@ ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc,
}
/* now that we have correct year, decode DOY */
- if (fmask & DTK_M(DOY))
+ if (fmask & DTK_M(DT_DOY))
{
j2date(date2j(tm->tm_year, 1, 1) + tm->tm_yday - 1,
&tm->tm_year, &tm->tm_mon, &tm->tm_mday);
}
/* check for valid month */
- if (fmask & DTK_M(MONTH))
+ if (fmask & DTK_M(DT_MONTH))
{
if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR)
return DTERR_MD_FIELD_OVERFLOW;
}
/* minimal check for valid day */
- if (fmask & DTK_M(DAY))
+ if (fmask & DTK_M(DT_DAY))
{
if (tm->tm_mday < 1 || tm->tm_mday > 31)
return DTERR_MD_FIELD_OVERFLOW;
@@ -2578,7 +2578,7 @@ DecodeTime(char *str, int fmask, int range,
tm->tm_sec = 0;
*fsec = 0;
/* If it's a MINUTE TO SECOND interval, take 2 fields as being mm:ss */
- if (range == (INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND)))
+ if (range == (INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND)))
{
tm->tm_sec = tm->tm_min;
tm->tm_min = tm->tm_hour;
@@ -2672,10 +2672,10 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
return DTERR_BAD_FORMAT;
/* Special case for day of year */
- if (flen == 3 && (fmask & DTK_DATE_M) == DTK_M(YEAR) && val >= 1 &&
+ if (flen == 3 && (fmask & DTK_DATE_M) == DTK_M(DT_YEAR) && val >= 1 &&
val <= 366)
{
- *tmask = (DTK_M(DOY) | DTK_M(MONTH) | DTK_M(DAY));
+ *tmask = (DTK_M(DT_DOY) | DTK_M(DT_MONTH) | DTK_M(DT_DAY));
tm->tm_yday = val;
/* tm_mon and tm_mday can't actually be set yet ... */
return 0;
@@ -2695,28 +2695,28 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
*/
if (flen >= 3 || DateOrder == DATEORDER_YMD)
{
- *tmask = DTK_M(YEAR);
+ *tmask = DTK_M(DT_YEAR);
tm->tm_year = val;
}
else if (DateOrder == DATEORDER_DMY)
{
- *tmask = DTK_M(DAY);
+ *tmask = DTK_M(DT_DAY);
tm->tm_mday = val;
}
else
{
- *tmask = DTK_M(MONTH);
+ *tmask = DTK_M(DT_MONTH);
tm->tm_mon = val;
}
break;
- case (DTK_M(YEAR)):
+ case (DTK_M(DT_YEAR)):
/* Must be at second field of YY-MM-DD */
- *tmask = DTK_M(MONTH);
+ *tmask = DTK_M(DT_MONTH);
tm->tm_mon = val;
break;
- case (DTK_M(MONTH)):
+ case (DTK_M(DT_MONTH)):
if (haveTextMonth)
{
/*
@@ -2728,62 +2728,62 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
*/
if (flen >= 3 || DateOrder == DATEORDER_YMD)
{
- *tmask = DTK_M(YEAR);
+ *tmask = DTK_M(DT_YEAR);
tm->tm_year = val;
}
else
{
- *tmask = DTK_M(DAY);
+ *tmask = DTK_M(DT_DAY);
tm->tm_mday = val;
}
}
else
{
/* Must be at second field of MM-DD-YY */
- *tmask = DTK_M(DAY);
+ *tmask = DTK_M(DT_DAY);
tm->tm_mday = val;
}
break;
- case (DTK_M(YEAR) | DTK_M(MONTH)):
+ case (DTK_M(DT_YEAR) | DTK_M(DT_MONTH)):
if (haveTextMonth)
{
/* Need to accept DD-MON-YYYY even in YMD mode */
if (flen >= 3 && *is2digits)
{
/* Guess that first numeric field is day was wrong */
- *tmask = DTK_M(DAY); /* YEAR is already set */
+ *tmask = DTK_M(DT_DAY); /* YEAR is already set */
tm->tm_mday = tm->tm_year;
tm->tm_year = val;
*is2digits = false;
}
else
{
- *tmask = DTK_M(DAY);
+ *tmask = DTK_M(DT_DAY);
tm->tm_mday = val;
}
}
else
{
/* Must be at third field of YY-MM-DD */
- *tmask = DTK_M(DAY);
+ *tmask = DTK_M(DT_DAY);
tm->tm_mday = val;
}
break;
- case (DTK_M(DAY)):
+ case (DTK_M(DT_DAY)):
/* Must be at second field of DD-MM-YY */
- *tmask = DTK_M(MONTH);
+ *tmask = DTK_M(DT_MONTH);
tm->tm_mon = val;
break;
- case (DTK_M(MONTH) | DTK_M(DAY)):
+ case (DTK_M(DT_MONTH) | DTK_M(DT_DAY)):
/* Must be at third field of DD-MM-YY or MM-DD-YY */
- *tmask = DTK_M(YEAR);
+ *tmask = DTK_M(DT_YEAR);
tm->tm_year = val;
break;
- case (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)):
+ case (DTK_M(DT_YEAR) | DTK_M(DT_MONTH) | DTK_M(DT_DAY)):
/* we have all the date, so it must be a time field */
dterr = DecodeNumberField(flen, str, fmask,
tmask, tm,
@@ -2801,7 +2801,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
* When processing a year field, mark it for adjustment if it's only one
* or two digits.
*/
- if (*tmask == DTK_M(YEAR))
+ if (*tmask == DTK_M(DT_YEAR))
*is2digits = (flen <= 2);
return 0;
@@ -2989,7 +2989,7 @@ DecodeTimezoneAbbrev(int field, char *lowtoken,
tp = abbrevcache[field];
/* use strncmp so that we match truncated tokens */
- if (tp == NULL || strncmp(lowtoken, tp->token, TOKMAXLEN) != 0)
+ if (tp == NULL || strncmp(lowtoken, tp->token, DT_TOKMAXLEN) != 0)
{
if (zoneabbrevtbl)
tp = datebsearch(lowtoken, zoneabbrevtbl->abbrevs,
@@ -2999,7 +2999,7 @@ DecodeTimezoneAbbrev(int field, char *lowtoken,
}
if (tp == NULL)
{
- type = UNKNOWN_FIELD;
+ type = DT_UNKNOWN_FIELD;
*offset = 0;
*tz = NULL;
}
@@ -3007,7 +3007,7 @@ DecodeTimezoneAbbrev(int field, char *lowtoken,
{
abbrevcache[field] = tp;
type = tp->type;
- if (type == DYNTZ)
+ if (type == DT_DYNTZ)
{
*offset = 0;
*tz = FetchDynamicTimeZone(zoneabbrevtbl, tp);
@@ -3043,13 +3043,13 @@ DecodeSpecial(int field, char *lowtoken, int *val)
tp = datecache[field];
/* use strncmp so that we match truncated tokens */
- if (tp == NULL || strncmp(lowtoken, tp->token, TOKMAXLEN) != 0)
+ if (tp == NULL || strncmp(lowtoken, tp->token, DT_TOKMAXLEN) != 0)
{
tp = datebsearch(lowtoken, datetktbl, szdatetktbl);
}
if (tp == NULL)
{
- type = UNKNOWN_FIELD;
+ type = DT_UNKNOWN_FIELD;
*val = 0;
}
else
@@ -3106,7 +3106,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
double fval;
*dtype = DTK_DELTA;
- type = IGNORE_DTF;
+ type = DT_IGNORE_DTF;
ClearPgTm(tm, fsec);
/* read through list backwards to pick up units before values */
@@ -3166,34 +3166,34 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
case DTK_DATE:
case DTK_NUMBER:
- if (type == IGNORE_DTF)
+ if (type == DT_IGNORE_DTF)
{
/* use typmod to decide what rightmost field is */
switch (range)
{
- case INTERVAL_MASK(YEAR):
+ case INTERVAL_MASK(DT_YEAR):
type = DTK_YEAR;
break;
- case INTERVAL_MASK(MONTH):
- case INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH):
+ case INTERVAL_MASK(DT_MONTH):
+ case INTERVAL_MASK(DT_YEAR) | INTERVAL_MASK(DT_MONTH):
type = DTK_MONTH;
break;
- case INTERVAL_MASK(DAY):
+ case INTERVAL_MASK(DT_DAY):
type = DTK_DAY;
break;
- case INTERVAL_MASK(HOUR):
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR):
+ case INTERVAL_MASK(DT_HOUR):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR):
type = DTK_HOUR;
break;
- case INTERVAL_MASK(MINUTE):
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_MINUTE):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
type = DTK_MINUTE;
break;
- case INTERVAL_MASK(SECOND):
- case INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_SECOND):
+ case INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
type = DTK_SECOND;
break;
default:
@@ -3247,7 +3247,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
{
case DTK_MICROSEC:
*fsec += rint(val + fval);
- tmask = DTK_M(MICROSECOND);
+ tmask = DTK_M(DT_MICROSECOND);
break;
case DTK_MILLISEC:
@@ -3255,7 +3255,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
tm->tm_sec += val / 1000;
val -= (val / 1000) * 1000;
*fsec += rint((val + fval) * 1000);
- tmask = DTK_M(MILLISECOND);
+ tmask = DTK_M(DT_MILLISECOND);
break;
case DTK_SECOND:
@@ -3267,7 +3267,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
* microsecond and millisecond input as well.
*/
if (fval == 0)
- tmask = DTK_M(SECOND);
+ tmask = DTK_M(DT_SECOND);
else
tmask = DTK_ALL_SECS_M;
break;
@@ -3275,60 +3275,60 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
case DTK_MINUTE:
tm->tm_min += val;
AdjustFractSeconds(fval, tm, fsec, SECS_PER_MINUTE);
- tmask = DTK_M(MINUTE);
+ tmask = DTK_M(DT_MINUTE);
break;
case DTK_HOUR:
tm->tm_hour += val;
AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR);
- tmask = DTK_M(HOUR);
+ tmask = DTK_M(DT_HOUR);
type = DTK_DAY; /* set for next field */
break;
case DTK_DAY:
tm->tm_mday += val;
AdjustFractSeconds(fval, tm, fsec, SECS_PER_DAY);
- tmask = DTK_M(DAY);
+ tmask = DTK_M(DT_DAY);
break;
case DTK_WEEK:
tm->tm_mday += val * 7;
AdjustFractDays(fval, tm, fsec, 7);
- tmask = DTK_M(WEEK);
+ tmask = DTK_M(DT_WEEK);
break;
case DTK_MONTH:
tm->tm_mon += val;
AdjustFractDays(fval, tm, fsec, DAYS_PER_MONTH);
- tmask = DTK_M(MONTH);
+ tmask = DTK_M(DT_MONTH);
break;
case DTK_YEAR:
tm->tm_year += val;
if (fval != 0)
tm->tm_mon += fval * MONTHS_PER_YEAR;
- tmask = DTK_M(YEAR);
+ tmask = DTK_M(DT_YEAR);
break;
case DTK_DECADE:
tm->tm_year += val * 10;
if (fval != 0)
tm->tm_mon += fval * MONTHS_PER_YEAR * 10;
- tmask = DTK_M(DECADE);
+ tmask = DTK_M(DT_DECADE);
break;
case DTK_CENTURY:
tm->tm_year += val * 100;
if (fval != 0)
tm->tm_mon += fval * MONTHS_PER_YEAR * 100;
- tmask = DTK_M(CENTURY);
+ tmask = DTK_M(DT_CENTURY);
break;
case DTK_MILLENNIUM:
tm->tm_year += val * 1000;
if (fval != 0)
tm->tm_mon += fval * MONTHS_PER_YEAR * 1000;
- tmask = DTK_M(MILLENNIUM);
+ tmask = DTK_M(DT_MILLENNIUM);
break;
default:
@@ -3339,22 +3339,22 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
case DTK_STRING:
case DTK_SPECIAL:
type = DecodeUnits(i, field[i], &val);
- if (type == IGNORE_DTF)
+ if (type == DT_IGNORE_DTF)
continue;
tmask = 0; /* DTK_M(type); */
switch (type)
{
- case UNITS:
+ case DT_UNITS:
type = val;
break;
- case AGO:
+ case DT_AGO:
is_before = true;
type = val;
break;
- case RESERV:
+ case DT_RESERV:
tmask = (DTK_DATE_M | DTK_TIME_M);
*dtype = val;
break;
@@ -3732,13 +3732,13 @@ DecodeUnits(int field, char *lowtoken, int *val)
tp = deltacache[field];
/* use strncmp so that we match truncated tokens */
- if (tp == NULL || strncmp(lowtoken, tp->token, TOKMAXLEN) != 0)
+ if (tp == NULL || strncmp(lowtoken, tp->token, DT_TOKMAXLEN) != 0)
{
tp = datebsearch(lowtoken, deltatktbl, szdeltatktbl);
}
if (tp == NULL)
{
- type = UNKNOWN_FIELD;
+ type = DT_UNKNOWN_FIELD;
*val = 0;
}
else
@@ -3823,7 +3823,7 @@ datebsearch(const char *key, const datetkn *base, int nel)
if (result == 0)
{
/* use strncmp so that we match truncated tokens */
- result = strncmp(key, position->token, TOKMAXLEN);
+ result = strncmp(key, position->token, DT_TOKMAXLEN);
if (result == 0)
return position;
}
@@ -4437,12 +4437,12 @@ CheckDateTokenTable(const char *tablename, const datetkn *base, int nel)
for (i = 0; i < nel; i++)
{
/* check for token strings that don't fit */
- if (strlen(base[i].token) > TOKMAXLEN)
+ if (strlen(base[i].token) > DT_TOKMAXLEN)
{
/* %.*s is safe since all our tokens are ASCII */
elog(LOG, "token too long in %s table: \"%.*s\"",
tablename,
- TOKMAXLEN + 1, base[i].token);
+ DT_TOKMAXLEN + 1, base[i].token);
ok = false;
break; /* don't risk applying strcmp */
}
@@ -4559,7 +4559,7 @@ ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n)
datetkn *dtoken = tbl->abbrevs + i;
/* use strlcpy to truncate name if necessary */
- strlcpy(dtoken->token, abbr->abbrev, TOKMAXLEN + 1);
+ strlcpy(dtoken->token, abbr->abbrev, DT_TOKMAXLEN + 1);
if (abbr->zone != NULL)
{
/* Allocate a DynamicZoneAbbrev for this abbreviation */
@@ -4570,7 +4570,7 @@ ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n)
dtza->tz = NULL;
strcpy(dtza->zone, abbr->zone);
- dtoken->type = DYNTZ;
+ dtoken->type = DT_DYNTZ;
/* value is offset from table start to DynamicZoneAbbrev */
dtoken->value = (int32) tbl_size;
@@ -4580,7 +4580,7 @@ ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n)
}
else
{
- dtoken->type = abbr->is_dst ? DTZ : TZ;
+ dtoken->type = abbr->is_dst ? DT_DTZ : DT_TZ;
dtoken->value = abbr->offset;
}
}
@@ -4616,7 +4616,7 @@ FetchDynamicTimeZone(TimeZoneAbbrevTable *tbl, const datetkn *tp)
DynamicZoneAbbrev *dtza;
/* Just some sanity checks to prevent indexing off into nowhere */
- Assert(tp->type == DYNTZ);
+ Assert(tp->type == DT_DYNTZ);
Assert(tp->value > 0 && tp->value < tbl->tblsize);
dtza = (DynamicZoneAbbrev *) ((char *) tbl + tp->value);
@@ -4656,7 +4656,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS)
Datum values[3];
bool nulls[3];
const datetkn *tp;
- char buffer[TOKMAXLEN + 1];
+ char buffer[DT_TOKMAXLEN + 1];
int gmtoffset;
bool is_dst;
unsigned char *p;
@@ -4710,15 +4710,15 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS)
switch (tp->type)
{
- case TZ:
+ case DT_TZ:
gmtoffset = tp->value;
is_dst = false;
break;
- case DTZ:
+ case DT_DTZ:
gmtoffset = tp->value;
is_dst = true;
break;
- case DYNTZ:
+ case DT_DYNTZ:
{
/* Determine the current meaning of the abbrev */
pg_tz *tzp;
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index b8bd4caa3e7..d7c1f849c81 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -3771,7 +3771,7 @@ do_to_timestamp(text *date_txt, text *fmt,
if (tmfc.bc && tm->tm_year > 0)
tm->tm_year = -(tm->tm_year - 1);
}
- fmask |= DTK_M(YEAR);
+ fmask |= DTK_M(DT_YEAR);
}
else if (tmfc.cc)
{
@@ -3784,7 +3784,7 @@ do_to_timestamp(text *date_txt, text *fmt,
else
/* +1 because year == 599 is 600 BC */
tm->tm_year = tmfc.cc * 100 + 1;
- fmask |= DTK_M(YEAR);
+ fmask |= DTK_M(DT_YEAR);
}
if (tmfc.j)
@@ -3816,12 +3816,12 @@ do_to_timestamp(text *date_txt, text *fmt,
if (tmfc.dd)
{
tm->tm_mday = tmfc.dd;
- fmask |= DTK_M(DAY);
+ fmask |= DTK_M(DT_DAY);
}
if (tmfc.mm)
{
tm->tm_mon = tmfc.mm;
- fmask |= DTK_M(MONTH);
+ fmask |= DTK_M(DT_MONTH);
}
if (tmfc.ddd && (tm->tm_mon <= 1 || tm->tm_mday <= 1))
@@ -3869,7 +3869,7 @@ do_to_timestamp(text *date_txt, text *fmt,
if (tm->tm_mday <= 1)
tm->tm_mday = tmfc.ddd - y[i - 1];
- fmask |= DTK_M(MONTH) | DTK_M(DAY);
+ fmask |= DTK_M(DT_MONTH) | DTK_M(DT_DAY);
}
}
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index 97a5b85516f..8392d0eb538 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -1504,7 +1504,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
break;
case JSONTYPE_DATE:
{
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
JsonEncodeDateTime(buf, val, DATEOID);
appendStringInfo(result, "\"%s\"", buf);
@@ -1512,7 +1512,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
break;
case JSONTYPE_TIMESTAMP:
{
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
JsonEncodeDateTime(buf, val, TIMESTAMPOID);
appendStringInfo(result, "\"%s\"", buf);
@@ -1520,7 +1520,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
break;
case JSONTYPE_TIMESTAMPTZ:
{
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
JsonEncodeDateTime(buf, val, TIMESTAMPTZOID);
appendStringInfo(result, "\"%s\"", buf);
@@ -1556,7 +1556,7 @@ char *
JsonEncodeDateTime(char *buf, Datum value, Oid typid)
{
if (!buf)
- buf = palloc(MAXDATELEN + 1);
+ buf = palloc(DT_MAXDATELEN + 1);
switch (typid)
{
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index ec857958273..f64356d31a3 100644
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -202,14 +202,14 @@ abstimein(PG_FUNCTION_ARGS)
struct pg_tm date,
*tm = &date;
int dterr;
- char *field[MAXDATEFIELDS];
- char workbuf[MAXDATELEN + 1];
+ char *field[DT_MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + 1];
int dtype;
int nf,
- ftype[MAXDATEFIELDS];
+ ftype[DT_MAXDATEFIELDS];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz);
if (dterr != 0)
@@ -265,8 +265,8 @@ abstimeout(PG_FUNCTION_ARGS)
double fsec = 0;
struct pg_tm tt,
*tm = &tt;
- char buf[MAXDATELEN + 1];
- char zone[MAXDATELEN + 1],
+ char buf[DT_MAXDATELEN + 1];
+ char zone[DT_MAXDATELEN + 1],
*tzn = zone;
switch (time)
@@ -276,13 +276,13 @@ abstimeout(PG_FUNCTION_ARGS)
* 'invalid' for abstime for now, but dump it someday.
*/
case INVALID_ABSTIME:
- strcpy(buf, INVALID);
+ strcpy(buf, DT_INVALID);
break;
case NOEND_ABSTIME:
- strcpy(buf, LATE);
+ strcpy(buf, DT_LATE);
break;
case NOSTART_ABSTIME:
- strcpy(buf, EARLY);
+ strcpy(buf, DT_EARLY);
break;
default:
abstime2tm(time, &tz, tm, &tzn);
@@ -471,7 +471,7 @@ abstime_timestamp(PG_FUNCTION_ARGS)
struct pg_tm tt,
*tm = &tt;
int tz;
- char zone[MAXDATELEN + 1],
+ char zone[DT_MAXDATELEN + 1],
*tzn = zone;
switch (abstime)
@@ -544,7 +544,7 @@ abstime_timestamptz(PG_FUNCTION_ARGS)
struct pg_tm tt,
*tm = &tt;
int tz;
- char zone[MAXDATELEN + 1],
+ char zone[DT_MAXDATELEN + 1],
*tzn = zone;
switch (abstime)
@@ -594,13 +594,13 @@ reltimein(PG_FUNCTION_ARGS)
fsec_t fsec;
int dtype;
int dterr;
- char *field[MAXDATEFIELDS];
+ char *field[DT_MAXDATEFIELDS];
int nf,
- ftype[MAXDATEFIELDS];
- char workbuf[MAXDATELEN + 1];
+ ftype[DT_MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + 1];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeInterval(field, ftype, nf, INTERVAL_FULL_RANGE,
&dtype, tm, &fsec);
@@ -644,7 +644,7 @@ reltimeout(PG_FUNCTION_ARGS)
char *result;
struct pg_tm tt,
*tm = &tt;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
reltime2tm(time, tm);
EncodeInterval(tm, 0, IntervalStyle, buf);
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index e6a1eed191e..02ff9f042d9 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -156,12 +156,12 @@ timestamp_in(PG_FUNCTION_ARGS)
int dtype;
int nf;
int dterr;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
- char workbuf[MAXDATELEN + MAXDATEFIELDS];
+ char *field[DT_MAXDATEFIELDS];
+ int ftype[DT_MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + DT_MAXDATEFIELDS];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz);
if (dterr != 0)
@@ -218,7 +218,7 @@ timestamp_out(PG_FUNCTION_ARGS)
struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
if (TIMESTAMP_NOT_FINITE(timestamp))
EncodeSpecialTimestamp(timestamp, buf);
@@ -396,12 +396,12 @@ timestamptz_in(PG_FUNCTION_ARGS)
int dtype;
int nf;
int dterr;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
- char workbuf[MAXDATELEN + MAXDATEFIELDS];
+ char *field[DT_MAXDATEFIELDS];
+ int ftype[DT_MAXDATEFIELDS];
+ char workbuf[DT_MAXDATELEN + DT_MAXDATEFIELDS];
dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
- field, ftype, MAXDATEFIELDS, &nf);
+ field, ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz);
if (dterr != 0)
@@ -508,12 +508,12 @@ parse_sane_timezone(struct pg_tm *tm, text *zone)
false);
type = DecodeTimezoneAbbrev(0, lowzone, &val, &tzp);
- if (type == TZ || type == DTZ)
+ if (type == DT_TZ || type == DT_DTZ)
{
/* fixed-offset abbreviation */
tz = -val;
}
- else if (type == DYNTZ)
+ else if (type == DT_DYNTZ)
{
/* dynamic-offset abbreviation, resolve using specified time */
tz = DetermineTimeZoneAbbrevOffset(tm, tzname, tzp);
@@ -767,7 +767,7 @@ timestamptz_out(PG_FUNCTION_ARGS)
*tm = &tt;
fsec_t fsec;
const char *tzn;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
if (TIMESTAMP_NOT_FINITE(dt))
EncodeSpecialTimestamp(dt, buf);
@@ -889,8 +889,8 @@ interval_in(PG_FUNCTION_ARGS)
int nf;
int range;
int dterr;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
+ char *field[DT_MAXDATEFIELDS];
+ int ftype[DT_MAXDATEFIELDS];
char workbuf[256];
tm->tm_year = 0;
@@ -907,7 +907,7 @@ interval_in(PG_FUNCTION_ARGS)
range = INTERVAL_FULL_RANGE;
dterr = ParseDateTime(str, workbuf, sizeof(workbuf), field,
- ftype, MAXDATEFIELDS, &nf);
+ ftype, DT_MAXDATEFIELDS, &nf);
if (dterr == 0)
dterr = DecodeInterval(field, ftype, nf, range,
&dtype, tm, &fsec);
@@ -962,7 +962,7 @@ interval_out(PG_FUNCTION_ARGS)
struct pg_tm tt,
*tm = &tt;
fsec_t fsec;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
if (interval2tm(*span, tm, &fsec) != 0)
elog(ERROR, "could not convert interval to tm");
@@ -1046,19 +1046,19 @@ intervaltypmodin(PG_FUNCTION_ARGS)
{
switch (tl[0])
{
- case INTERVAL_MASK(YEAR):
- case INTERVAL_MASK(MONTH):
- case INTERVAL_MASK(DAY):
- case INTERVAL_MASK(HOUR):
- case INTERVAL_MASK(MINUTE):
- case INTERVAL_MASK(SECOND):
- case INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH):
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR):
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
- case INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_YEAR):
+ case INTERVAL_MASK(DT_MONTH):
+ case INTERVAL_MASK(DT_DAY):
+ case INTERVAL_MASK(DT_HOUR):
+ case INTERVAL_MASK(DT_MINUTE):
+ case INTERVAL_MASK(DT_SECOND):
+ case INTERVAL_MASK(DT_YEAR) | INTERVAL_MASK(DT_MONTH):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
+ case INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
case INTERVAL_FULL_RANGE:
/* all OK */
break;
@@ -1125,43 +1125,43 @@ intervaltypmodout(PG_FUNCTION_ARGS)
switch (fields)
{
- case INTERVAL_MASK(YEAR):
+ case INTERVAL_MASK(DT_YEAR):
fieldstr = " year";
break;
- case INTERVAL_MASK(MONTH):
+ case INTERVAL_MASK(DT_MONTH):
fieldstr = " month";
break;
- case INTERVAL_MASK(DAY):
+ case INTERVAL_MASK(DT_DAY):
fieldstr = " day";
break;
- case INTERVAL_MASK(HOUR):
+ case INTERVAL_MASK(DT_HOUR):
fieldstr = " hour";
break;
- case INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_MINUTE):
fieldstr = " minute";
break;
- case INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_SECOND):
fieldstr = " second";
break;
- case INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH):
+ case INTERVAL_MASK(DT_YEAR) | INTERVAL_MASK(DT_MONTH):
fieldstr = " year to month";
break;
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR):
fieldstr = " day to hour";
break;
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
fieldstr = " day to minute";
break;
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
fieldstr = " day to second";
break;
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
fieldstr = " hour to minute";
break;
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
fieldstr = " hour to second";
break;
- case INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
fieldstr = " minute to second";
break;
case INTERVAL_FULL_RANGE:
@@ -1199,31 +1199,31 @@ intervaltypmodleastfield(int32 typmod)
switch (INTERVAL_RANGE(typmod))
{
- case INTERVAL_MASK(YEAR):
+ case INTERVAL_MASK(DT_YEAR):
return 5; /* YEAR */
- case INTERVAL_MASK(MONTH):
+ case INTERVAL_MASK(DT_MONTH):
return 4; /* MONTH */
- case INTERVAL_MASK(DAY):
+ case INTERVAL_MASK(DT_DAY):
return 3; /* DAY */
- case INTERVAL_MASK(HOUR):
+ case INTERVAL_MASK(DT_HOUR):
return 2; /* HOUR */
- case INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_MINUTE):
return 1; /* MINUTE */
- case INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_SECOND):
return 0; /* SECOND */
- case INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH):
+ case INTERVAL_MASK(DT_YEAR) | INTERVAL_MASK(DT_MONTH):
return 4; /* MONTH */
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR):
return 2; /* HOUR */
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
return 1; /* MINUTE */
- case INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_DAY) | INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
return 0; /* SECOND */
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE):
return 1; /* MINUTE */
- case INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_HOUR) | INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
return 0; /* SECOND */
- case INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND):
+ case INTERVAL_MASK(DT_MINUTE) | INTERVAL_MASK(DT_SECOND):
return 0; /* SECOND */
case INTERVAL_FULL_RANGE:
return 0; /* SECOND */
@@ -1372,81 +1372,81 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
{
/* Do nothing... */
}
- else if (range == INTERVAL_MASK(YEAR))
+ else if (range == INTERVAL_MASK(DT_YEAR))
{
interval->month = (interval->month / MONTHS_PER_YEAR) * MONTHS_PER_YEAR;
interval->day = 0;
interval->time = 0;
}
- else if (range == INTERVAL_MASK(MONTH))
+ else if (range == INTERVAL_MASK(DT_MONTH))
{
interval->day = 0;
interval->time = 0;
}
/* YEAR TO MONTH */
- else if (range == (INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH)))
+ else if (range == (INTERVAL_MASK(DT_YEAR) | INTERVAL_MASK(DT_MONTH)))
{
interval->day = 0;
interval->time = 0;
}
- else if (range == INTERVAL_MASK(DAY))
+ else if (range == INTERVAL_MASK(DT_DAY))
{
interval->time = 0;
}
- else if (range == INTERVAL_MASK(HOUR))
+ else if (range == INTERVAL_MASK(DT_HOUR))
{
interval->time = (interval->time / USECS_PER_HOUR) *
USECS_PER_HOUR;
}
- else if (range == INTERVAL_MASK(MINUTE))
+ else if (range == INTERVAL_MASK(DT_MINUTE))
{
interval->time = (interval->time / USECS_PER_MINUTE) *
USECS_PER_MINUTE;
}
- else if (range == INTERVAL_MASK(SECOND))
+ else if (range == INTERVAL_MASK(DT_SECOND))
{
/* fractional-second rounding will be dealt with below */
}
/* DAY TO HOUR */
- else if (range == (INTERVAL_MASK(DAY) |
- INTERVAL_MASK(HOUR)))
+ else if (range == (INTERVAL_MASK(DT_DAY) |
+ INTERVAL_MASK(DT_HOUR)))
{
interval->time = (interval->time / USECS_PER_HOUR) *
USECS_PER_HOUR;
}
/* DAY TO MINUTE */
- else if (range == (INTERVAL_MASK(DAY) |
- INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE)))
+ else if (range == (INTERVAL_MASK(DT_DAY) |
+ INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE)))
{
interval->time = (interval->time / USECS_PER_MINUTE) *
USECS_PER_MINUTE;
}
/* DAY TO SECOND */
- else if (range == (INTERVAL_MASK(DAY) |
- INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE) |
- INTERVAL_MASK(SECOND)))
+ else if (range == (INTERVAL_MASK(DT_DAY) |
+ INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE) |
+ INTERVAL_MASK(DT_SECOND)))
{
/* fractional-second rounding will be dealt with below */
}
/* HOUR TO MINUTE */
- else if (range == (INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE)))
+ else if (range == (INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE)))
{
interval->time = (interval->time / USECS_PER_MINUTE) *
USECS_PER_MINUTE;
}
/* HOUR TO SECOND */
- else if (range == (INTERVAL_MASK(HOUR) |
- INTERVAL_MASK(MINUTE) |
- INTERVAL_MASK(SECOND)))
+ else if (range == (INTERVAL_MASK(DT_HOUR) |
+ INTERVAL_MASK(DT_MINUTE) |
+ INTERVAL_MASK(DT_SECOND)))
{
/* fractional-second rounding will be dealt with below */
}
/* MINUTE TO SECOND */
- else if (range == (INTERVAL_MASK(MINUTE) |
- INTERVAL_MASK(SECOND)))
+ else if (range == (INTERVAL_MASK(DT_MINUTE) |
+ INTERVAL_MASK(DT_SECOND)))
{
/* fractional-second rounding will be dealt with below */
}
@@ -1523,9 +1523,9 @@ void
EncodeSpecialTimestamp(Timestamp dt, char *str)
{
if (TIMESTAMP_IS_NOBEGIN(dt))
- strcpy(str, EARLY);
+ strcpy(str, DT_EARLY);
else if (TIMESTAMP_IS_NOEND(dt))
- strcpy(str, LATE);
+ strcpy(str, DT_LATE);
else /* shouldn't happen */
elog(ERROR, "invalid argument for EncodeSpecialTimestamp");
}
@@ -1709,7 +1709,7 @@ timestamptz_to_time_t(TimestampTz t)
const char *
timestamptz_to_str(TimestampTz t)
{
- static char buf[MAXDATELEN + 1];
+ static char buf[DT_MAXDATELEN + 1];
int tz;
struct pg_tm tt,
*tm = &tt;
@@ -3689,7 +3689,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
type = DecodeUnits(0, lowunits, &val);
- if (type == UNITS)
+ if (type == DT_UNITS)
{
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
ereport(ERROR,
@@ -3816,7 +3816,7 @@ timestamptz_trunc(PG_FUNCTION_ARGS)
type = DecodeUnits(0, lowunits, &val);
- if (type == UNITS)
+ if (type == DT_UNITS)
{
if (timestamp2tm(timestamp, &tz, tm, &fsec, NULL, NULL) != 0)
ereport(ERROR,
@@ -3962,7 +3962,7 @@ interval_trunc(PG_FUNCTION_ARGS)
type = DecodeUnits(0, lowunits, &val);
- if (type == UNITS)
+ if (type == DT_UNITS)
{
if (interval2tm(*interval, tm, &fsec) == 0)
{
@@ -4220,7 +4220,7 @@ static float8
NonFiniteTimestampTzPart(int type, int unit, char *lowunits,
bool isNegative, bool isTz)
{
- if ((type != UNITS) && (type != RESERV))
+ if ((type != DT_UNITS) && (type != DT_RESERV))
{
if (isTz)
ereport(ERROR,
@@ -4304,7 +4304,7 @@ timestamp_part(PG_FUNCTION_ARGS)
false);
type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(0, lowunits, &val);
if (TIMESTAMP_NOT_FINITE(timestamp))
@@ -4318,7 +4318,7 @@ timestamp_part(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
- if (type == UNITS)
+ if (type == DT_UNITS)
{
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
ereport(ERROR,
@@ -4448,7 +4448,7 @@ timestamp_part(PG_FUNCTION_ARGS)
result = 0;
}
}
- else if (type == RESERV)
+ else if (type == DT_RESERV)
{
switch (val)
{
@@ -4505,7 +4505,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
false);
type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(0, lowunits, &val);
if (TIMESTAMP_NOT_FINITE(timestamp))
@@ -4519,7 +4519,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
- if (type == UNITS)
+ if (type == DT_UNITS)
{
if (timestamp2tm(timestamp, &tz, tm, &fsec, NULL, NULL) != 0)
ereport(ERROR,
@@ -4650,7 +4650,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
}
}
- else if (type == RESERV)
+ else if (type == DT_RESERV)
{
switch (val)
{
@@ -4706,10 +4706,10 @@ interval_part(PG_FUNCTION_ARGS)
false);
type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
+ if (type == DT_UNKNOWN_FIELD)
type = DecodeSpecial(0, lowunits, &val);
- if (type == UNITS)
+ if (type == DT_UNITS)
{
if (interval2tm(*interval, tm, &fsec) == 0)
{
@@ -4781,7 +4781,7 @@ interval_part(PG_FUNCTION_ARGS)
result = 0;
}
}
- else if (type == RESERV && val == DTK_EPOCH)
+ else if (type == DT_RESERV && val == DTK_EPOCH)
{
result = interval->time / 1000000.0;
result += ((double) DAYS_PER_YEAR * SECS_PER_DAY) * (interval->month / MONTHS_PER_YEAR);
@@ -4856,13 +4856,13 @@ timestamp_zone(PG_FUNCTION_ARGS)
type = DecodeTimezoneAbbrev(0, lowzone, &val, &tzp);
- if (type == TZ || type == DTZ)
+ if (type == DT_TZ || type == DT_DTZ)
{
/* fixed-offset abbreviation */
tz = val;
result = dt2local(timestamp, tz);
}
- else if (type == DYNTZ)
+ else if (type == DT_DYNTZ)
{
/* dynamic-offset abbreviation, resolve using specified time */
if (timestamp2tm(timestamp, NULL, &tm, &fsec, NULL, tzp) != 0)
@@ -5064,13 +5064,13 @@ timestamptz_zone(PG_FUNCTION_ARGS)
type = DecodeTimezoneAbbrev(0, lowzone, &val, &tzp);
- if (type == TZ || type == DTZ)
+ if (type == DT_TZ || type == DT_DTZ)
{
/* fixed-offset abbreviation */
tz = -val;
result = dt2local(timestamp, tz);
}
- else if (type == DYNTZ)
+ else if (type == DT_DYNTZ)
{
/* dynamic-offset abbreviation, resolve using specified time */
int isdst;
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 7cdb87ef85b..fc39bd68184 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -2079,7 +2079,7 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
{
DateADT date;
struct pg_tm tm;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
date = DatumGetDateADT(value);
/* XSD doesn't support infinite values */
@@ -2100,7 +2100,7 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
Timestamp timestamp;
struct pg_tm tm;
fsec_t fsec;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
timestamp = DatumGetTimestamp(value);
@@ -2127,7 +2127,7 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
int tz;
fsec_t fsec;
const char *tzn = NULL;
- char buf[MAXDATELEN + 1];
+ char buf[DT_MAXDATELEN + 1];
timestamp = DatumGetTimestamp(value);
diff --git a/src/backend/utils/misc/tzparser.c b/src/backend/utils/misc/tzparser.c
index 3d07eb7265d..d63ef9e311f 100644
--- a/src/backend/utils/misc/tzparser.c
+++ b/src/backend/utils/misc/tzparser.c
@@ -56,10 +56,10 @@ validateTzEntry(tzEntry *tzentry)
* Check restrictions imposed by datetkntbl storage format (see
* datetime.c)
*/
- if (strlen(tzentry->abbrev) > TOKMAXLEN)
+ if (strlen(tzentry->abbrev) > DT_TOKMAXLEN)
{
GUC_check_errmsg("time zone abbreviation \"%s\" is too long (maximum %d characters) in time zone file \"%s\", line %d",
- tzentry->abbrev, TOKMAXLEN,
+ tzentry->abbrev, DT_TOKMAXLEN,
tzentry->filename, tzentry->lineno);
return false;
}
diff --git a/src/bin/pg_waldump/compat.c b/src/bin/pg_waldump/compat.c
index 6ff9eb7e77b..d5af971c527 100644
--- a/src/bin/pg_waldump/compat.c
+++ b/src/bin/pg_waldump/compat.c
@@ -49,9 +49,9 @@ timestamptz_to_time_t(TimestampTz t)
const char *
timestamptz_to_str(TimestampTz dt)
{
- static char buf[MAXDATELEN + 1];
- char ts[MAXDATELEN + 1];
- char zone[MAXDATELEN + 1];
+ static char buf[DT_MAXDATELEN + 1];
+ char ts[DT_MAXDATELEN + 1];
+ char zone[DT_MAXDATELEN + 1];
time_t result = (time_t) timestamptz_to_time_t(dt);
struct tm *ltime = localtime(&result);
diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h
index d66582b7a2b..8658958bda8 100644
--- a/src/include/utils/datetime.h
+++ b/src/include/utils/datetime.h
@@ -33,34 +33,34 @@ struct tzEntry;
* ----------------------------------------------------------------
*/
-#define DAGO "ago"
-#define DCURRENT "current"
-#define EPOCH "epoch"
-#define INVALID "invalid"
-#define EARLY "-infinity"
-#define LATE "infinity"
-#define NOW "now"
-#define TODAY "today"
-#define TOMORROW "tomorrow"
-#define YESTERDAY "yesterday"
-#define ZULU "zulu"
+#define DT_DAGO "ago"
+#define DT_DCURRENT "current"
+#define DT_EPOCH "epoch"
+#define DT_INVALID "invalid"
+#define DT_EARLY "-infinity"
+#define DT_LATE "infinity"
+#define DT_NOW "now"
+#define DT_TODAY "today"
+#define DT_TOMORROW "tomorrow"
+#define DT_YESTERDAY "yesterday"
+#define DT_ZULU "zulu"
-#define DMICROSEC "usecond"
-#define DMILLISEC "msecond"
-#define DSECOND "second"
-#define DMINUTE "minute"
-#define DHOUR "hour"
-#define DDAY "day"
-#define DWEEK "week"
-#define DMONTH "month"
-#define DQUARTER "quarter"
-#define DYEAR "year"
-#define DDECADE "decade"
-#define DCENTURY "century"
-#define DMILLENNIUM "millennium"
-#define DA_D "ad"
-#define DB_C "bc"
-#define DTIMEZONE "timezone"
+#define DT_DMICROSEC "usecond"
+#define DT_DMILLISEC "msecond"
+#define DT_DSECOND "second"
+#define DT_DMINUTE "minute"
+#define DT_DHOUR "hour"
+#define DT_DDAY "day"
+#define DT_DWEEK "week"
+#define DT_DMONTH "month"
+#define DT_DQUARTER "quarter"
+#define DT_DYEAR "year"
+#define DT_DDECADE "decade"
+#define DT_DCENTURY "century"
+#define DT_DMILLENNIUM "millennium"
+#define DT_DA_D "ad"
+#define DT_DB_C "bc"
+#define DT_DTIMEZONE "timezone"
/*
* Fundamental time field definitions for parsing.
@@ -69,12 +69,12 @@ struct tzEntry;
* Millennium: ad, bc
*/
-#define AM 0
-#define PM 1
-#define HR24 2
+#define DT_AM 0
+#define DT_PM 1
+#define DT_HR24 2
-#define AD 0
-#define BC 1
+#define DT_AD 0
+#define DT_BC 1
/*
* Field types for time decoding.
@@ -88,41 +88,41 @@ struct tzEntry;
* are stored in typmods, you can't change them without initdb!
*/
-#define RESERV 0
-#define MONTH 1
-#define YEAR 2
-#define DAY 3
-#define JULIAN 4
-#define TZ 5 /* fixed-offset timezone abbreviation */
-#define DTZ 6 /* fixed-offset timezone abbrev, DST */
-#define DYNTZ 7 /* dynamic timezone abbreviation */
-#define IGNORE_DTF 8
-#define AMPM 9
-#define HOUR 10
-#define MINUTE 11
-#define SECOND 12
-#define MILLISECOND 13
-#define MICROSECOND 14
-#define DOY 15
-#define DOW 16
-#define UNITS 17
-#define ADBC 18
+#define DT_RESERV 0
+#define DT_MONTH 1
+#define DT_YEAR 2
+#define DT_DAY 3
+#define DT_JULIAN 4
+#define DT_TZ 5 /* fixed-offset timezone abbreviation */
+#define DT_DTZ 6 /* fixed-offset timezone abbrev, DST */
+#define DT_DYNTZ 7 /* dynamic timezone abbreviation */
+#define DT_IGNORE_DTF 8
+#define DT_AMPM 9
+#define DT_HOUR 10
+#define DT_MINUTE 11
+#define DT_SECOND 12
+#define DT_MILLISECOND 13
+#define DT_MICROSECOND 14
+#define DT_DOY 15
+#define DT_DOW 16
+#define DT_UNITS 17
+#define DT_ADBC 18
/* these are only for relative dates */
-#define AGO 19
-#define ABS_BEFORE 20
-#define ABS_AFTER 21
+#define DT_AGO 19
+#define DT_ABS_BEFORE 20
+#define DT_ABS_AFTER 21
/* generic fields to help with parsing */
-#define ISODATE 22
-#define ISOTIME 23
+#define DT_ISODATE 22
+#define DT_ISOTIME 23
/* these are only for parsing intervals */
-#define WEEK 24
-#define DECADE 25
-#define CENTURY 26
-#define MILLENNIUM 27
+#define DT_WEEK 24
+#define DT_DECADE 25
+#define DT_CENTURY 26
+#define DT_MILLENNIUM 27
/* hack for parsing two-word timezone specs "MET DST" etc */
-#define DTZMOD 28 /* "DST" as a separate word */
+#define DT_ZMOD 28 /* "DST" as a separate word */
/* reserved for unrecognized string values */
-#define UNKNOWN_FIELD 31
+#define DT_UNKNOWN_FIELD 31
/*
* Token field definitions for time parsing and decoding.
@@ -139,60 +139,60 @@ struct tzEntry;
* renumbering values in either of these apparently-independent lists :-(
*/
-#define DTK_NUMBER 0
-#define DTK_STRING 1
+#define DTK_NUMBER 0
+#define DTK_STRING 1
-#define DTK_DATE 2
-#define DTK_TIME 3
-#define DTK_TZ 4
-#define DTK_AGO 5
+#define DTK_DATE 2
+#define DTK_TIME 3
+#define DTK_TZ 4
+#define DTK_AGO 5
-#define DTK_SPECIAL 6
-#define DTK_INVALID 7
-#define DTK_CURRENT 8
-#define DTK_EARLY 9
-#define DTK_LATE 10
-#define DTK_EPOCH 11
-#define DTK_NOW 12
-#define DTK_YESTERDAY 13
-#define DTK_TODAY 14
-#define DTK_TOMORROW 15
-#define DTK_ZULU 16
+#define DTK_SPECIAL 6
+#define DTK_INVALID 7
+#define DTK_CURRENT 8
+#define DTK_EARLY 9
+#define DTK_LATE 10
+#define DTK_EPOCH 11
+#define DTK_NOW 12
+#define DTK_YESTERDAY 13
+#define DTK_TODAY 14
+#define DTK_TOMORROW 15
+#define DTK_ZULU 16
-#define DTK_DELTA 17
-#define DTK_SECOND 18
-#define DTK_MINUTE 19
-#define DTK_HOUR 20
-#define DTK_DAY 21
-#define DTK_WEEK 22
-#define DTK_MONTH 23
-#define DTK_QUARTER 24
-#define DTK_YEAR 25
-#define DTK_DECADE 26
-#define DTK_CENTURY 27
-#define DTK_MILLENNIUM 28
-#define DTK_MILLISEC 29
-#define DTK_MICROSEC 30
-#define DTK_JULIAN 31
+#define DTK_DELTA 17
+#define DTK_SECOND 18
+#define DTK_MINUTE 19
+#define DTK_HOUR 20
+#define DTK_DAY 21
+#define DTK_WEEK 22
+#define DTK_MONTH 23
+#define DTK_QUARTER 24
+#define DTK_YEAR 25
+#define DTK_DECADE 26
+#define DTK_CENTURY 27
+#define DTK_MILLENNIUM 28
+#define DTK_MILLISEC 29
+#define DTK_MICROSEC 30
+#define DTK_JULIAN 31
-#define DTK_DOW 32
-#define DTK_DOY 33
-#define DTK_TZ_HOUR 34
-#define DTK_TZ_MINUTE 35
-#define DTK_ISOYEAR 36
-#define DTK_ISODOW 37
+#define DTK_DOW 32
+#define DTK_DOY 33
+#define DTK_TZ_HOUR 34
+#define DTK_TZ_MINUTE 35
+#define DTK_ISOYEAR 36
+#define DTK_ISODOW 37
/*
* Bit mask definitions for time parsing.
*/
-#define DTK_M(t) (0x01 << (t))
+#define DTK_M(t) (0x01 << (t))
/* Convenience: a second, plus any fractional component */
-#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND))
-#define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
-#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M)
+#define DTK_ALL_SECS_M (DTK_M(DT_SECOND) | DTK_M(DT_MILLISECOND) | DTK_M(DT_MICROSECOND))
+#define DTK_DATE_M (DTK_M(DT_YEAR) | DTK_M(DT_MONTH) | DTK_M(DT_DAY))
+#define DTK_TIME_M (DTK_M(DT_HOUR) | DTK_M(DT_MINUTE) | DTK_ALL_SECS_M)
/*
* Working buffer size for input and output of interval, timestamp, etc.
@@ -200,16 +200,16 @@ struct tzEntry;
* will overrun buffers, so this must suffice for all possible output. As of
* this writing, interval_out() needs the most space at ~90 bytes.
*/
-#define MAXDATELEN 128
+#define DT_MAXDATELEN 128
/* maximum possible number of fields in a date string */
-#define MAXDATEFIELDS 25
+#define DT_MAXDATEFIELDS 25
/* only this many chars are stored in datetktbl */
-#define TOKMAXLEN 10
+#define DT_TOKMAXLEN 10
/* keep this struct small; it gets used a lot */
typedef struct
{
- char token[TOKMAXLEN + 1]; /* always NUL-terminated */
+ char token[DT_TOKMAXLEN + 1]; /* always NUL-terminated */
char type; /* see field type codes above */
int32 value; /* meaning depends on type */
} datetkn;
--
2.15.1.354.g95ec6b1b33.dirty
--ynrj22hw3c6yyuvg--
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
@ 2023-03-08 21:25 Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Stephen Frost @ 2023-03-08 21:25 UTC (permalink / raw)
To: Chris Travers <[email protected]>; +Cc: [email protected]; Bruce Momjian <[email protected]>; David Christensen <[email protected]>
Greetings,
* Chris Travers ([email protected]) wrote:
> From the documentation, the primary threat model of TDE is to prevent decryption of data from archived wal segments (and data files), for example on a backup system. While there are other methods around this problem to date, I think that this feature is worth pursuing for that reason. I want to address a couple of reasons for this and then go into some reservations I have about how some of this is documented.
Agreed, though the latest efforts include an option for *authenticated*
encryption as well as unauthenticated. That makes it much more
difficult to make undetected changes to the data that's protected by
the authenticated encryption being used.
> There are current workarounds to ensuring encryption at rest, but these have a number of problems. Encryption passphrases end up lying around the system in various places. Key rotation is often difficult. And one mistake can easily render all efforts ineffective. TDE solves these problems. The overall design from the internal docs looks solid. This definitely is something I would recommend for many users.
There's clearly user demand for it as there's a number of organizations
who have forks which are providing it in one shape or another. This
kind of splintering of the community is actually an actively bad thing
for the project and is part of what killed Unix, by at least some pretty
reputable accounts, in my view.
> I have a couple small caveats though. Encryption of data is a large topic and there isn't a one-size-fits-all solution to industrial or state requirements. Having all this key management available in PostgreSQL is a very good thing. Long run it is likely to end up being extensible, and therefore both more powerful and offering a wider range of choices for solution architects. Implementing encryption is also something that is easy to mess up. For this reason I think it would be great if we had a standardized format for discussing encryption options that we could use going forward. I don't think that should be held against this patch but I think we need to start discussing it now because it will be a bigger problem later.
Do you have a suggestion as to the format to use?
> A second caveat I have is that key management is a topic where you really need a good overview of internals in order to implement effectively. If you don't know how an SSL handshake works or what is in a certificate, you can easily make mistakes in setting up SSL. I can see the same thing happening here. For example, I don't think it would be safe to leave the KEK on an encrypted filesystem that is decrypted at runtime (or at least I wouldn't consider that safe -- your appetite for risk may vary).
Agreed that we should document this and make clear that the KEK is
necessary for server start but absolutely should be kept as safe as
possible and certainly not stored on disk somewhere nearby the encrypted
cluster.
> My proposal would be to have build a template for encryption options in the documentation. This could include topics like SSL as well. In such a template we'd have sections like "Threat model," "How it works," "Implementation Requirements" and so forth. Again I don't think this needs to be part of the current patch but I think it is something we need to start thinking about now. Maybe after this goes in, I can present a proposed documentation patch.
I'm not entirely sure that it makes sense to lump this and TLS in the
same place as they end up being rather independent at the end of the
day. If you have ideas for how to improve the documentation, I'd
certainly encourage you to go ahead and work on that and submit it as a
patch rather than waiting for this to actually land in core. Having
good and solid documentation is something that will help this get in,
after all, and to the extent that it's covering existing topics like
TLS, those could likely be included independently and that would be of
benefit to everyone.
> I will also note that I don't consider myself to be very qualified on topics like encryption. I can reason about key management to some extent but some implementation details may be beyond me. I would hope we could get some extra review on this patch set soon.
Certainly agree with you there though there's an overall trajectory of
patches involved in all of this that's a bit deep. The plan is to
discuss that at PGCon (On the Road to TDE) and at the PGCon
Unconference after. I certainly hope those interested will be there.
I'm also happy to have a call with anyone interested in this effort
independent of that, of course.
Thanks!
Stephen
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
@ 2023-03-27 16:38 ` Bruce Momjian <[email protected]>
2023-03-27 22:01 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Bruce Momjian @ 2023-03-27 16:38 UTC (permalink / raw)
To: Stephen Frost <[email protected]>; +Cc: Chris Travers <[email protected]>; [email protected]; David Christensen <[email protected]>
On Wed, Mar 8, 2023 at 04:25:04PM -0500, Stephen Frost wrote:
> Agreed, though the latest efforts include an option for *authenticated*
> encryption as well as unauthenticated. That makes it much more
> difficult to make undetected changes to the data that's protected by
> the authenticated encryption being used.
I thought some more about this. GCM-style authentication of encrypted
data has value because it assumes the two end points are secure but that
a malicious actor could modify data during transfer. In the Postgres
case, it seems the two end points and the transfer are all in the same
place. Therefore, it is unclear to me the value of using GCM-style
authentication because if the GCM-level can be modified, so can the end
points, and the encryption key exposed.
> There's clearly user demand for it as there's a number of organizations
> who have forks which are providing it in one shape or another. This
> kind of splintering of the community is actually an actively bad thing
> for the project and is part of what killed Unix, by at least some pretty
> reputable accounts, in my view.
Yes, the number of commercial implementations of this is a concern. Of
course, it is also possible that those commercial implementations are
meeting checkbox requirements rather than technical ones, and the
community has been hostile to check box-only features.
> Certainly agree with you there though there's an overall trajectory of
> patches involved in all of this that's a bit deep. The plan is to
> discuss that at PGCon (On the Road to TDE) and at the PGCon
> Unconference after. I certainly hope those interested will be there.
> I'm also happy to have a call with anyone interested in this effort
> independent of that, of course.
I will not be attending Ottawa.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Embrace your flaws. They make you human, rather than perfect,
which you will never be.
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
@ 2023-03-27 22:01 ` Stephen Frost <[email protected]>
2023-03-27 22:16 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Stephen Frost @ 2023-03-27 22:01 UTC (permalink / raw)
To: Bruce Momjian <[email protected]>; +Cc: Chris Travers <[email protected]>; David Christensen <[email protected]>; [email protected]
Greetings,
On Mon, Mar 27, 2023 at 12:38 Bruce Momjian <[email protected]> wrote:
> On Wed, Mar 8, 2023 at 04:25:04PM -0500, Stephen Frost wrote:
> > Agreed, though the latest efforts include an option for *authenticated*
> > encryption as well as unauthenticated. That makes it much more
> > difficult to make undetected changes to the data that's protected by
> > the authenticated encryption being used.
>
> I thought some more about this. GCM-style authentication of encrypted
> data has value because it assumes the two end points are secure but that
> a malicious actor could modify data during transfer. In the Postgres
> case, it seems the two end points and the transfer are all in the same
> place. Therefore, it is unclear to me the value of using GCM-style
> authentication because if the GCM-level can be modified, so can the end
> points, and the encryption key exposed.
What are the two end points you are referring to and why don’t you feel
there is an opportunity between them for a malicious actor to attack the
system?
There are simpler cases to consider than an online attack on a single
independent system where an attacker having access to modify the data in
transit between PG and the storage would imply the attacker also having
access to read keys out of PG’s memory.
As specific examples, consider:
An attack against the database system where the database server is shut
down, or a backup, and the encryption key isn’t available on the system.
The backup system itself, not running as the PG user (an option supported
by PG and at least pgbackrest) being compromised, thus allowing for
injection of changes into a backup or into a restore.
The beginning of this discussion also very clearly had individuals voicing
strong opinions that unauthenticated encryption methods were not acceptable
as an end-state for PG due to the clear issue of there then being no
protection against modification of data. The approach we are working
towards provides both the unauthenticated option, which clearly has value
to a large number of our collective user base considering the number of
commercial implementations which have now arisen, and the authenticated
solution which goes further and provides the level clearly expected of the
PG community. This gets us a win-win situation.
> There's clearly user demand for it as there's a number of organizations
> > who have forks which are providing it in one shape or another. This
> > kind of splintering of the community is actually an actively bad thing
> > for the project and is part of what killed Unix, by at least some pretty
> > reputable accounts, in my view.
>
> Yes, the number of commercial implementations of this is a concern. Of
> course, it is also possible that those commercial implementations are
> meeting checkbox requirements rather than technical ones, and the
> community has been hostile to check box-only features.
I’ve grown weary of this argument as the other major piece of work it was
routinely applied to was RLS and yet that has certainly been seen broadly
as a beneficial feature with users clearly leveraging it and in more than
some “checkbox” way.
Indeed, it’s similar also in that commercial implementations were done of
RLS while there were arguments made about it being a checkbox feature which
were used to discourage it from being implemented in core. Were it truly
checkbox, I don’t feel we would have the regular and ongoing discussion
about it on the lists that we do, nor see other tools built on top of PG
which specifically leverage it. Perhaps there are truly checkbox features
out there which we will never implement, but I’m (perhaps due to what my
dad would call selective listening on my part, perhaps not) having trouble
coming up with any presently. Features that exist in other systems that we
don’t want? Certainly. We don’t characterize those as simply “checkbox”
though. Perhaps that’s in part because we provide alternatives- but that’s
not the case here. We have no comparable way to have this capability as
part of the core system.
We, as a community, are clearly losing value by lack of this capability, if
by no other measure than simply the numerous users of the commercial
implementations feeling that they simply can’t use PG without this feature,
for whatever their reasoning.
Thanks,
Stephen
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:01 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
@ 2023-03-27 22:16 ` Bruce Momjian <[email protected]>
2023-03-27 22:57 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Bruce Momjian @ 2023-03-27 22:16 UTC (permalink / raw)
To: Stephen Frost <[email protected]>; +Cc: Chris Travers <[email protected]>; David Christensen <[email protected]>; [email protected]
On Tue, Mar 28, 2023 at 12:01:56AM +0200, Stephen Frost wrote:
> Greetings,
>
> On Mon, Mar 27, 2023 at 12:38 Bruce Momjian <[email protected]> wrote:
>
> On Wed, Mar 8, 2023 at 04:25:04PM -0500, Stephen Frost wrote:
> > Agreed, though the latest efforts include an option for *authenticated*
> > encryption as well as unauthenticated. That makes it much more
> > difficult to make undetected changes to the data that's protected by
> > the authenticated encryption being used.
>
> I thought some more about this. GCM-style authentication of encrypted
> data has value because it assumes the two end points are secure but that
> a malicious actor could modify data during transfer. In the Postgres
> case, it seems the two end points and the transfer are all in the same
> place. Therefore, it is unclear to me the value of using GCM-style
> authentication because if the GCM-level can be modified, so can the end
> points, and the encryption key exposed.
>
>
> What are the two end points you are referring to and why don’t you feel there
> is an opportunity between them for a malicious actor to attack the system?
Uh, TLS can use GCM and in this case you assume the sender and receiver
are secure, no?
> There are simpler cases to consider than an online attack on a single
> independent system where an attacker having access to modify the data in
> transit between PG and the storage would imply the attacker also having access
> to read keys out of PG’s memory.
I consider the operating system and its processes as much more of a
single entity than TLS over a network.
> As specific examples, consider:
>
> An attack against the database system where the database server is shut down,
> or a backup, and the encryption key isn’t available on the system.
>
> The backup system itself, not running as the PG user (an option supported by PG
> and at least pgbackrest) being compromised, thus allowing for injection of
> changes into a backup or into a restore.
I then question why we are not adding encryption to pg_basebackup or
pgbackrest rather than the database system.
> The beginning of this discussion also very clearly had individuals voicing
> strong opinions that unauthenticated encryption methods were not acceptable as
> an end-state for PG due to the clear issue of there then being no protection
> against modification of data. The approach we are working towards provides
What were the _technical_ reasons for those objections?
> both the unauthenticated option, which clearly has value to a large number of
> our collective user base considering the number of commercial implementations
> which have now arisen, and the authenticated solution which goes further and
> provides the level clearly expected of the PG community. This gets us a win-win
> situation.
>
> > There's clearly user demand for it as there's a number of organizations
> > who have forks which are providing it in one shape or another. This
> > kind of splintering of the community is actually an actively bad thing
> > for the project and is part of what killed Unix, by at least some pretty
> > reputable accounts, in my view.
>
> Yes, the number of commercial implementations of this is a concern. Of
> course, it is also possible that those commercial implementations are
> meeting checkbox requirements rather than technical ones, and the
> community has been hostile to check box-only features.
>
>
> I’ve grown weary of this argument as the other major piece of work it was
> routinely applied to was RLS and yet that has certainly been seen broadly as a
> beneficial feature with users clearly leveraging it and in more than some
> “checkbox” way.
RLS has to overcome that objection, and I think it did, as was better
for doing that.
> We, as a community, are clearly losing value by lack of this capability, if by
> no other measure than simply the numerous users of the commercial
> implementations feeling that they simply can’t use PG without this feature, for
> whatever their reasoning.
That is true, but I go back to my concern over useful feature vs. check
box.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Embrace your flaws. They make you human, rather than perfect,
which you will never be.
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:01 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 22:16 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
@ 2023-03-27 22:57 ` Stephen Frost <[email protected]>
2023-03-27 23:19 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Stephen Frost @ 2023-03-27 22:57 UTC (permalink / raw)
To: Bruce Momjian <[email protected]>; +Cc: Chris Travers <[email protected]>; David Christensen <[email protected]>; [email protected]
Greetings,
On Mon, Mar 27, 2023 at 18:17 Bruce Momjian <[email protected]> wrote:
> On Tue, Mar 28, 2023 at 12:01:56AM +0200, Stephen Frost wrote:
> > Greetings,
> >
> > On Mon, Mar 27, 2023 at 12:38 Bruce Momjian <[email protected]> wrote:
> >
> > On Wed, Mar 8, 2023 at 04:25:04PM -0500, Stephen Frost wrote:
> > > Agreed, though the latest efforts include an option for
> *authenticated*
> > > encryption as well as unauthenticated. That makes it much more
> > > difficult to make undetected changes to the data that's protected
> by
> > > the authenticated encryption being used.
> >
> > I thought some more about this. GCM-style authentication of
> encrypted
> > data has value because it assumes the two end points are secure but
> that
> > a malicious actor could modify data during transfer. In the Postgres
> > case, it seems the two end points and the transfer are all in the
> same
> > place. Therefore, it is unclear to me the value of using GCM-style
> > authentication because if the GCM-level can be modified, so can the
> end
> > points, and the encryption key exposed.
> >
> >
> > What are the two end points you are referring to and why don’t you feel
> there
> > is an opportunity between them for a malicious actor to attack the
> system?
>
> Uh, TLS can use GCM and in this case you assume the sender and receiver
> are secure, no?
TLS does use GCM.. pretty much exclusively as far as I can recall. So do a
lot of other things though..
> There are simpler cases to consider than an online attack on a single
> > independent system where an attacker having access to modify the data in
> > transit between PG and the storage would imply the attacker also having
> access
> > to read keys out of PG’s memory.
>
> I consider the operating system and its processes as much more of a
> single entity than TLS over a network.
This may be the case sometimes but there’s absolutely no shortage of other
cases and it’s almost more the rule these days, that there is some kind of
network between the OS processes and the storage- a SAN, an iSCSI network,
NFS, are all quite common.
> As specific examples, consider:
> >
> > An attack against the database system where the database server is shut
> down,
> > or a backup, and the encryption key isn’t available on the system.
> >
> > The backup system itself, not running as the PG user (an option
> supported by PG
> > and at least pgbackrest) being compromised, thus allowing for injection
> of
> > changes into a backup or into a restore.
>
> I then question why we are not adding encryption to pg_basebackup or
> pgbackrest rather than the database system.
Pgbackrest has encryption and authentication of it … but that doesn’t
actually address the attack vector that I outlined. If the backup user is
compromised then they can change the data before it gets to the storage.
If the backup user is compromised then they have access to whatever key is
used to encrypt and authenticate the backup and therefore can trivially
manipulate the data.
Encryption of backups by the backup tool serves to protect the data after
it leaves the backup system and is stored in cloud storage or in whatever
format the repository takes. This is beneficial, particularly when the
data itself offers no protection, but simply not the same.
> The beginning of this discussion also very clearly had individuals voicing
> > strong opinions that unauthenticated encryption methods were not
> acceptable as
> > an end-state for PG due to the clear issue of there then being no
> protection
> > against modification of data. The approach we are working towards
> provides
>
> What were the _technical_ reasons for those objections?
I believe largely the ones I’m bringing up here and which I outline above…
I don’t mean to pretend that any of this is of my own independent
construction. I don’t believe it is and my apologies if it came across that
way.
> both the unauthenticated option, which clearly has value to a large
> number of
> > our collective user base considering the number of commercial
> implementations
> > which have now arisen, and the authenticated solution which goes further
> and
> > provides the level clearly expected of the PG community. This gets us a
> win-win
> > situation.
> >
> > > There's clearly user demand for it as there's a number of
> organizations
> > > who have forks which are providing it in one shape or another.
> This
> > > kind of splintering of the community is actually an actively bad
> thing
> > > for the project and is part of what killed Unix, by at least some
> pretty
> > > reputable accounts, in my view.
> >
> > Yes, the number of commercial implementations of this is a concern.
> Of
> > course, it is also possible that those commercial implementations are
> > meeting checkbox requirements rather than technical ones, and the
> > community has been hostile to check box-only features.
> >
> >
> > I’ve grown weary of this argument as the other major piece of work it was
> > routinely applied to was RLS and yet that has certainly been seen
> broadly as a
> > beneficial feature with users clearly leveraging it and in more than some
> > “checkbox” way.
>
> RLS has to overcome that objection, and I think it did, as was better
> for doing that.
Beyond it being called a checkbox - what were the arguments against it? I
don’t object to being challenged to point out the use cases, but I feel
that at least some very clear and straight forward ones are outlined from
what has been said above. I also don’t believe those are the only ones but
I don’t think I could enumerate every use case for RLS either, even after
seeing it used for quite a few years. I do seriously question the level of
effort expected of features that are claimed to be “Checkbox” and tossed
almost exclusively for that reason on this list given the success of the
ones that have been accepted and are in active use by our users today.
> We, as a community, are clearly losing value by lack of this capability,
> if by
> > no other measure than simply the numerous users of the commercial
> > implementations feeling that they simply can’t use PG without this
> feature, for
> > whatever their reasoning.
>
> That is true, but I go back to my concern over useful feature vs. check
> box.
While it’s easy to label something as checkbox, I don’t feel we have been
fair to our users in doing so as it has historically prevented features
which our users are demanding and end up getting from commercial providers
until we implement them ultimately anyway. This particular argument simply
doesn’t seem to actually hold the value that proponents of it claim, for us
at least, and we have clear counter-examples which we can point to and I
hope we learn from those.
Thanks!
Stephen
>
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:01 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 22:16 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:57 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
@ 2023-03-27 23:19 ` Bruce Momjian <[email protected]>
2023-03-28 00:03 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Bruce Momjian @ 2023-03-27 23:19 UTC (permalink / raw)
To: Stephen Frost <[email protected]>; +Cc: Chris Travers <[email protected]>; David Christensen <[email protected]>; [email protected]
On Tue, Mar 28, 2023 at 12:57:42AM +0200, Stephen Frost wrote:
> I consider the operating system and its processes as much more of a
> single entity than TLS over a network.
>
> This may be the case sometimes but there’s absolutely no shortage of other
> cases and it’s almost more the rule these days, that there is some kind of
> network between the OS processes and the storage- a SAN, an iSCSI network, NFS,
> are all quite common.
Yes, but consider that the database cluster is having to get its data
from that remote storage --- the remote storage is not an independent
entity that can be corrupted without the databaes server being
compromised. If everything in PGDATA was GCM-verified, it would be
secure, but because some parts are not, I don't think it would be.
> > As specific examples, consider:
> >
> > An attack against the database system where the database server is shut
> down,
> > or a backup, and the encryption key isn’t available on the system.
> >
> > The backup system itself, not running as the PG user (an option supported
> by PG
> > and at least pgbackrest) being compromised, thus allowing for injection
> of
> > changes into a backup or into a restore.
>
> I then question why we are not adding encryption to pg_basebackup or
> pgbackrest rather than the database system.
>
> Pgbackrest has encryption and authentication of it … but that doesn’t actually
> address the attack vector that I outlined. If the backup user is compromised
> then they can change the data before it gets to the storage. If the backup
> user is compromised then they have access to whatever key is used to encrypt
> and authenticate the backup and therefore can trivially manipulate the data.
So the idea is that the backup user can be compromised without the data
being vulnerable --- makes sense, though that use-case seems narrow.
> What were the _technical_ reasons for those objections?
>
> I believe largely the ones I’m bringing up here and which I outline above… I
> don’t mean to pretend that any of this is of my own independent construction. I
> don’t believe it is and my apologies if it came across that way.
Yes, there is value beyond the check-box, but in most cases those
values are limited considering the complexity of the features, and the
check-box is what most people are asking for, I think.
> > I’ve grown weary of this argument as the other major piece of work it was
> > routinely applied to was RLS and yet that has certainly been seen broadly
> as a
> > beneficial feature with users clearly leveraging it and in more than some
> > “checkbox” way.
>
> RLS has to overcome that objection, and I think it did, as was better
> for doing that.
>
> Beyond it being called a checkbox - what were the arguments against it? I
The RLS arguments were that queries could expoose some of the underlying
data, but in summary, that was considered acceptable.
> > We, as a community, are clearly losing value by lack of this capability,
> if by
> > no other measure than simply the numerous users of the commercial
> > implementations feeling that they simply can’t use PG without this
> feature, for
> > whatever their reasoning.
>
> That is true, but I go back to my concern over useful feature vs. check
> box.
>
> While it’s easy to label something as checkbox, I don’t feel we have been fair
No, actually, it isn't. I am not sure why you are saying that.
> to our users in doing so as it has historically prevented features which our
> users are demanding and end up getting from commercial providers until we
> implement them ultimately anyway. This particular argument simply doesn’t seem
> to actually hold the value that proponents of it claim, for us at least, and we
> have clear counter-examples which we can point to and I hope we learn from
> those.
I don't think you are addressing actual issues above.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Embrace your flaws. They make you human, rather than perfect,
which you will never be.
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Moving forward with TDE
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:01 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 22:16 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:57 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 23:19 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
@ 2023-03-28 00:03 ` Stephen Frost <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Stephen Frost @ 2023-03-28 00:03 UTC (permalink / raw)
To: Bruce Momjian <[email protected]>; +Cc: Chris Travers <[email protected]>; David Christensen <[email protected]>; [email protected]
Greetings,
On Mon, Mar 27, 2023 at 19:19 Bruce Momjian <[email protected]> wrote:
> On Tue, Mar 28, 2023 at 12:57:42AM +0200, Stephen Frost wrote:
> > I consider the operating system and its processes as much more of a
> > single entity than TLS over a network.
> >
> > This may be the case sometimes but there’s absolutely no shortage of
> other
> > cases and it’s almost more the rule these days, that there is some kind
> of
> > network between the OS processes and the storage- a SAN, an iSCSI
> network, NFS,
> > are all quite common.
>
> Yes, but consider that the database cluster is having to get its data
> from that remote storage --- the remote storage is not an independent
> entity that can be corrupted without the databaes server being
> compromised. If everything in PGDATA was GCM-verified, it would be
> secure, but because some parts are not, I don't think it would be.
The remote storage is certainly an independent system. Multi-mount LUNs are
entirely possible in a SAN (and absolutely with NFS, or just the NFS server
itself is compromised..), so while the attacker may not have any access to
the database server itself, they may have access to these other systems,
and that’s not even considering in-transit attacks which are also
absolutely possible, especially with iSCSI or NFS.
I don’t understand what is being claimed that the remote storage is “not an
independent system” based on my understanding of, eg, NFS. With NFS, a
directory on the NFS server is exported and the client mounts that
directory as NFS locally, all over a network which may or may not be
secured against manipulation. A user on the NFS server with root access is
absolutely able to access and modify files on the NFS server trivially,
even if they have no access to the PG server. Would you explain what you
mean?
I do agree that the ideal case would be that we encrypt everything we can
(not everything can be for various reasons, but we don’t actually need to
either) in the PGDATA directory is encrypted and authenticated, just like
it would be ideal if everything was checksum’d and isn’t today. We are
progressing in that direction thanks to efforts such as reworking the other
subsystems to used shared buffers and a consistent page format, but just
like with checksums we do not need to have the perfect solution for us to
provide a lot of value here- and our users know that as the same is true of
the unauthenticated encryption approaches being offered by the commercial
solutions.
> > As specific examples, consider:
> > >
> > > An attack against the database system where the database server is
> shut
> > down,
> > > or a backup, and the encryption key isn’t available on the system.
> > >
> > > The backup system itself, not running as the PG user (an option
> supported
> > by PG
> > > and at least pgbackrest) being compromised, thus allowing for
> injection
> > of
> > > changes into a backup or into a restore.
> >
> > I then question why we are not adding encryption to pg_basebackup or
> > pgbackrest rather than the database system.
> >
> > Pgbackrest has encryption and authentication of it … but that doesn’t
> actually
> > address the attack vector that I outlined. If the backup user is
> compromised
> > then they can change the data before it gets to the storage. If the
> backup
> > user is compromised then they have access to whatever key is used to
> encrypt
> > and authenticate the backup and therefore can trivially manipulate the
> data.
>
> So the idea is that the backup user can be compromised without the data
> being vulnerable --- makes sense, though that use-case seems narrow.
That’s perhaps a fair consideration- but it’s clearly of enough value that
many of our users are asking for it and not using PG because we don’t have
it today. Ultimately though, this clearly makes it more than a “checkbox”
feature. I hope we are able to agree on that now.
> What were the _technical_ reasons for those objections?
> >
> > I believe largely the ones I’m bringing up here and which I outline
> above… I
> > don’t mean to pretend that any of this is of my own independent
> construction. I
> > don’t believe it is and my apologies if it came across that way.
>
> Yes, there is value beyond the check-box, but in most cases those
> values are limited considering the complexity of the features, and the
> check-box is what most people are asking for, I think.
For the users who ask on the lists for this feature, regularly, how many
don’t ask because they google or find prior responses on the list to the
question of if we have this capability? How do we know that their cases
are “checkbox”? Consider that there are standards groups which explicitly
consider these attack vectors and consider them important enough to require
mitigations to address those vectors. Do the end users of PG understand the
attack vectors or why they matter? Perhaps not, but just because they
can’t articulate the reasoning does NOT mean that the attack vector doesn’t
exist or that their environment is somehow immune to it- indeed, as the
standards bodies surely know, the opposite is true- they’re almost
certainly at risk of those attack vectors and therefore the standards
bodies are absolutely justified in requiring them to provide a solution.
Treating these users as unimportant because they don’t have the depth of
understanding that we do or that the standards body does is not helping
them- it’s actively driving them away from PG.
> > I’ve grown weary of this argument as the other major piece of work
> it was
> > > routinely applied to was RLS and yet that has certainly been seen
> broadly
> > as a
> > > beneficial feature with users clearly leveraging it and in more
> than some
> > > “checkbox” way.
> >
> > RLS has to overcome that objection, and I think it did, as was better
> > for doing that.
> >
> > Beyond it being called a checkbox - what were the arguments against it?
> I
>
> The RLS arguments were that queries could expoose some of the underlying
> data, but in summary, that was considered acceptable.
This is an excellent point- and dovetails very nicely into my argument that
protecting primary data (what is provided by users and ends up in indexes
and heaps) is valuable even if we don’t (yet..) have protection for other
parts of the system. Reducing the size of the attack vector is absolutely
useful, especially when it’s such a large amount of the data in the system.
Yes, we should, and will, continue to improve- as we do with many features,
but we don’t need to wait for perfection to include this feature, just as
with RLS and numerous other features we have.
> > We, as a community, are clearly losing value by lack of this
> capability,
> > if by
> > > no other measure than simply the numerous users of the commercial
> > > implementations feeling that they simply can’t use PG without this
> > feature, for
> > > whatever their reasoning.
> >
> > That is true, but I go back to my concern over useful feature vs.
> check
> > box.
> >
> > While it’s easy to label something as checkbox, I don’t feel we have
> been fair
>
> No, actually, it isn't. I am not sure why you are saying that.
I’m confused as to what is required to label a feature as a “checkbox”
feature then. What did you us to make that determination of this feature?
I’m happy to be wrong here.
> to our users in doing so as it has historically prevented features which
> our
> > users are demanding and end up getting from commercial providers until we
> > implement them ultimately anyway. This particular argument simply
> doesn’t seem
> > to actually hold the value that proponents of it claim, for us at least,
> and we
> > have clear counter-examples which we can point to and I hope we learn
> from
> > those.
>
> I don't think you are addressing actual issues above.
Specifics would be really helpful. I don’t doubt that there are things I’m
missing, but I’ve tried to address each point raised clearly and concisely.
Thanks!
Stephen
>
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v53 3/7] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index f1ab3aa3fe0..02d28df1c6a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--qr3jlalmmcpkiodg
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v53-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v54 2/5] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index f1ab3aa3fe0..02d28df1c6a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--cdhh4t7ukb6tnjoq
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v54-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v55 1/2] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index f1ab3aa3fe0..02d28df1c6a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--k3knmf76cw7vbhar
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v55-0002-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v49 2/7] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--3n3vqr5y2jhknrqj
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v49-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v50 2/8] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--brnevsqjnuzpyok4
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v50-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v52 02/10] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--gp2pyozrd5pweboh
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v52-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v52 02/10] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--gp2pyozrd5pweboh
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v52-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v51 02/10] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--r2slln3zpmilwu22
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v51-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v51 02/10] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--r2slln3zpmilwu22
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v51-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v50 2/8] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--brnevsqjnuzpyok4
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v50-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v53 3/7] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index f1ab3aa3fe0..02d28df1c6a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--qr3jlalmmcpkiodg
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v53-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v55 1/2] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index f1ab3aa3fe0..02d28df1c6a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--k3knmf76cw7vbhar
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v55-0002-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v49 2/7] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--3n3vqr5y2jhknrqj
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v49-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v54 2/5] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index d3be8939011..5db4fe75dce 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..e2882a50b3b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index f1ab3aa3fe0..02d28df1c6a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--cdhh4t7ukb6tnjoq
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v54-0003-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v48 3/7] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index 81a55a33ef2..d492bddcd73 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 8b4ebc6f226..505473ed852 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--qfkt2ktdpcfeypib
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v48-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v48 3/7] Rename cluster.c/h -> repack.c/h
@ 2026-03-31 16:55 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Herrera @ 2026-03-31 16:55 UTC (permalink / raw)
---
src/backend/commands/Makefile | 2 +-
src/backend/commands/matview.c | 2 +-
src/backend/commands/meson.build | 2 +-
src/backend/commands/{cluster.c => repack.c} | 6 +++---
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/vacuum.c | 6 +++---
src/backend/storage/ipc/procsignal.c | 1 +
src/backend/tcop/postgres.c | 1 +
src/backend/tcop/utility.c | 2 +-
src/include/commands/{cluster.h => repack.h} | 12 ++++++------
10 files changed, 19 insertions(+), 17 deletions(-)
rename src/backend/commands/{cluster.c => repack.c} (99%)
rename src/include/commands/{cluster.h => repack.h} (90%)
diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile
index c10fdba2bbb..fe1bba3a9b9 100644
--- a/src/backend/commands/Makefile
+++ b/src/backend/commands/Makefile
@@ -18,7 +18,6 @@ OBJS = \
amcmds.o \
analyze.o \
async.o \
- cluster.o \
collationcmds.o \
comment.o \
constraint.o \
@@ -51,6 +50,7 @@ OBJS = \
proclang.o \
propgraphcmds.o \
publicationcmds.o \
+ repack.o \
schemacmds.o \
seclabel.o \
sequence.o \
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index 81a55a33ef2..d492bddcd73 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -24,8 +24,8 @@
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opclass.h"
-#include "commands/cluster.h"
#include "commands/matview.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
index 90c7e37a429..f624aae74af 100644
--- a/src/backend/commands/meson.build
+++ b/src/backend/commands/meson.build
@@ -6,7 +6,6 @@ backend_sources += files(
'amcmds.c',
'analyze.c',
'async.c',
- 'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
@@ -39,6 +38,7 @@ backend_sources += files(
'proclang.c',
'propgraphcmds.c',
'publicationcmds.c',
+ 'repack.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/repack.c
similarity index 99%
rename from src/backend/commands/cluster.c
rename to src/backend/commands/repack.c
index f241e18b153..20f0a572236 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/repack.c
@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
- * cluster.c
+ * repack.c
* REPACK a table; formerly known as CLUSTER. VACUUM FULL also uses
* parts of this code.
*
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * src/backend/commands/cluster.c
+ * src/backend/commands/repack.c
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
#include "catalog/pg_am.h"
#include "catalog/pg_inherits.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/tablecmds.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 8b4ebc6f226..505473ed852 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -57,10 +57,10 @@
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
-#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
+#include "commands/repack.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0ed363d1c85..b179b62b5c8 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -9,7 +9,7 @@
*
* VACUUM for heap AM is implemented in vacuumlazy.c, parallel vacuum in
* vacuumparallel.c, ANALYZE in analyze.c, and VACUUM FULL is a variant of
- * CLUSTER, handled in cluster.c.
+ * REPACK, handled in repack.c.
*
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
@@ -38,9 +38,9 @@
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/defrem.h"
#include "commands/progress.h"
+#include "commands/repack.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
@@ -2293,7 +2293,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
if ((params.options & VACOPT_VERBOSE) != 0)
cluster_params.options |= CLUOPT_VERBOSE;
- /* VACUUM FULL is a variant of REPACK; see cluster.c */
+ /* VACUUM FULL is a variant of REPACK; see repack.c */
cluster_rel(REPACK_COMMAND_VACUUMFULL, rel, InvalidOid,
&cluster_params);
/* cluster_rel closes the relation, but keeps lock */
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 7e017c8d53b..7cef6e43661 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -19,6 +19,7 @@
#include "access/parallel.h"
#include "commands/async.h"
+#include "commands/repack.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/pg_bitutils.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 10be60011ad..9fbaa5c00f0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -39,6 +39,7 @@
#include "commands/event_trigger.h"
#include "commands/explain_state.h"
#include "commands/prepare.h"
+#include "commands/repack.h"
#include "common/pg_prng.h"
#include "jit/jit.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 2b609bfc824..5f8c766c4be 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -26,7 +26,6 @@
#include "catalog/toasting.h"
#include "commands/alter.h"
#include "commands/async.h"
-#include "commands/cluster.h"
#include "commands/collationcmds.h"
#include "commands/comment.h"
#include "commands/conversioncmds.h"
@@ -46,6 +45,7 @@
#include "commands/proclang.h"
#include "commands/propgraphcmds.h"
#include "commands/publicationcmds.h"
+#include "commands/repack.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h"
#include "commands/sequence.h"
diff --git a/src/include/commands/cluster.h b/src/include/commands/repack.h
similarity index 90%
rename from src/include/commands/cluster.h
rename to src/include/commands/repack.h
index d6b62c747e8..85061158b0c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/repack.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * cluster.h
- * header file for postgres cluster command stuff
+ * repack.h
+ * header file for the REPACK command
*
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * src/include/commands/cluster.h
+ * src/include/commands/repack.h
*
*-------------------------------------------------------------------------
*/
-#ifndef CLUSTER_H
-#define CLUSTER_H
+#ifndef REPACK_H
+#define REPACK_H
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
@@ -52,4 +52,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
MultiXactId cutoffMulti,
char newrelpersistence);
-#endif /* CLUSTER_H */
+#endif /* REPACK_H */
--
2.47.3
--qfkt2ktdpcfeypib
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v48-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch"
^ permalink raw reply [nested|flat] 24+ messages in thread
end of thread, other threads:[~2026-03-31 16:55 UTC | newest]
Thread overview: 24+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 06:06 [PATCH] WIP: Deconflict datetime.h macro names. Andres Freund <[email protected]>
2023-03-08 21:25 Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 16:38 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:01 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 22:16 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-27 22:57 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2023-03-27 23:19 ` Re: Moving forward with TDE Bruce Momjian <[email protected]>
2023-03-28 00:03 ` Re: Moving forward with TDE Stephen Frost <[email protected]>
2026-03-31 16:55 [PATCH v53 3/7] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v54 2/5] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v55 1/2] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v49 2/7] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v50 2/8] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v52 02/10] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v52 02/10] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v51 02/10] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v51 02/10] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v50 2/8] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v53 3/7] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v55 1/2] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v49 2/7] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v54 2/5] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v48 3/7] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
2026-03-31 16:55 [PATCH v48 3/7] Rename cluster.c/h -> repack.c/h Álvaro Herrera <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox