agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
[PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
1830+ messages / 1 participants
[nested] [flat]

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--WiF/3tUCR6j/q9wa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v10-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--jWUVADOU6pvU/6ap
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.55.0


--gzHy1cBrLyG9oicL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v12-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--QnbX+ZG8KQOMO1rs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v8-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--IZet2WR372zTYuyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v11-0004-Simplify-autovacuum-s-TOAST-to-main-relation-rel.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index a4abb29cf64..4ee1f913b64 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2191,20 +2191,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index f0824b6899a..f1b96b1099d 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--FpyHeza52HC3lxIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v5-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--0oaK7sfrjhxPo9Xw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v9-0004-Simplify-autovacuum-s-TOAST-to-main-relation-relo.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread

* [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup.
@ 2026-06-08 20:27 Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 1830+ messages in thread

From: Nathan Bossart @ 2026-06-08 20:27 UTC (permalink / raw)

This commit adds a new value to StdRdOptIndexCleanup to distinguish
whether it is explicitly set, similar to ViewOptCheckOption's
VIEW_OPTION_CHECK_OPTION_NOT_SET.  This changes only the internal
representation; an unset value still defaults to AUTO, and the
option accepts the same input as before.

This is preparatory work for a follow-up commit that will make use
of the new "unset" state.
---
 src/backend/access/common/reloptions.c |  3 ++-
 src/backend/commands/vacuum.c          | 23 ++++++++++++++---------
 src/include/utils/rel.h                |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 79834126f2f..58eb72e2339 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
 /* values from StdRdOptIndexCleanup */
 static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
 {
+	/* no value for NOT_SET */
 	{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
 	{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
 	{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
 			ShareUpdateExclusiveLock
 		},
 		StdRdOptIndexCleanupValues,
-		STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
+		STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 		gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
 	},
 	{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 31f9824899c..52116c02b59 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
 		StdRdOptIndexCleanup vacuum_index_cleanup;
 
 		if (rel->rd_options == NULL)
-			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
+			vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
 		else
 			vacuum_index_cleanup =
 				((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
 
-		if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
-			params.index_cleanup = VACOPTVALUE_AUTO;
-		else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
-			params.index_cleanup = VACOPTVALUE_ENABLED;
-		else
+		switch (vacuum_index_cleanup)
 		{
-			Assert(vacuum_index_cleanup ==
-				   STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
-			params.index_cleanup = VACOPTVALUE_DISABLED;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
+				params.index_cleanup = VACOPTVALUE_ENABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
+				params.index_cleanup = VACOPTVALUE_DISABLED;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
+			case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
+				params.index_cleanup = VACOPTVALUE_AUTO;
+				break;
 		}
 	}
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 2ee98e9c6cc..01b6e1a872c 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
 	STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
+	STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
 } StdRdOptIndexCleanup;
 
 typedef struct StdRdOptions
-- 
2.50.1 (Apple Git-155)


--RRYXFNkLLTDnSeAO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v6-0004-Fix-VACUUM-and-autovacuum-handling-of-TOAST-stora.patch



^ permalink  raw  reply  [nested|flat] 1830+ messages in thread


end of thread, other threads:[~2026-06-08 20:27 UTC | newest]

Thread overview: 1830+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v10 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v7 3/5] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v12 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v8 3/7] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v11 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v5 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v9 3/8] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>
2026-06-08 20:27 [PATCH v6 3/4] Add an "unset" value for vacuum_index_cleanup. Nathan Bossart <nathan@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox