@@ -170,6 +170,27 @@ static relopt_ternary ternaryRelOpts[] =
170170 RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
171171 ShareUpdateExclusiveLock
172172 },
173+ NULL ,
174+ TERNARY_UNSET
175+ },
176+ {
177+ {
178+ "vacuum_index_cleanup" ,
179+ "Controls index vacuuming and index cleanup" ,
180+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
181+ ShareUpdateExclusiveLock
182+ },
183+ "auto" ,
184+ TERNARY_UNSET
185+ },
186+ {
187+ {
188+ "buffering" ,
189+ "Enables buffering build for this GiST index" ,
190+ RELOPT_KIND_GIST ,
191+ AccessExclusiveLock
192+ },
193+ "auto" ,
173194 TERNARY_UNSET
174195 },
175196 /* list terminator */
@@ -498,30 +519,6 @@ static relopt_real realRelOpts[] =
498519 {{NULL }}
499520};
500521
501- /* values from StdRdOptIndexCleanup */
502- static relopt_enum_elt_def StdRdOptIndexCleanupValues [] =
503- {
504- {"auto" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO },
505- {"on" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON },
506- {"off" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF },
507- {"true" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON },
508- {"false" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF },
509- {"yes" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON },
510- {"no" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF },
511- {"1" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON },
512- {"0" , STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF },
513- {(const char * ) NULL } /* list terminator */
514- };
515-
516- /* values from GistOptBufferingMode */
517- static relopt_enum_elt_def gistBufferingOptValues [] =
518- {
519- {"auto" , GIST_OPTION_BUFFERING_AUTO },
520- {"on" , GIST_OPTION_BUFFERING_ON },
521- {"off" , GIST_OPTION_BUFFERING_OFF },
522- {(const char * ) NULL } /* list terminator */
523- };
524-
525522/* values from ViewOptCheckOption */
526523static relopt_enum_elt_def viewCheckOptValues [] =
527524{
@@ -533,28 +530,6 @@ static relopt_enum_elt_def viewCheckOptValues[] =
533530
534531static relopt_enum enumRelOpts [] =
535532{
536- {
537- {
538- "vacuum_index_cleanup" ,
539- "Controls index vacuuming and index cleanup" ,
540- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
541- ShareUpdateExclusiveLock
542- },
543- StdRdOptIndexCleanupValues ,
544- STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO ,
545- gettext_noop ("Valid values are \"on\", \"off\", and \"auto\"." )
546- },
547- {
548- {
549- "buffering" ,
550- "Enables buffering build for this GiST index" ,
551- RELOPT_KIND_GIST ,
552- AccessExclusiveLock
553- },
554- gistBufferingOptValues ,
555- GIST_OPTION_BUFFERING_AUTO ,
556- gettext_noop ("Valid values are \"on\", \"off\", and \"auto\"." )
557- },
558533 {
559534 {
560535 "check_option" ,
@@ -922,13 +897,14 @@ add_local_bool_reloption(local_relopts *relopts, const char *name,
922897 */
923898static relopt_ternary *
924899init_ternary_reloption (bits32 kinds , const char * name , const char * desc ,
925- ternary default_val , LOCKMODE lockmode )
900+ ternary default_val , const char * unset_alias , LOCKMODE lockmode )
926901{
927902 relopt_ternary * newoption ;
928903
929904 newoption = (relopt_ternary * ) allocate_reloption (kinds ,
930905 RELOPT_TYPE_TERNARY , name , desc , lockmode );
931906 newoption -> default_val = default_val ;
907+ newoption -> unset_alias = unset_alias ;
932908
933909 return newoption ;
934910}
@@ -939,10 +915,10 @@ init_ternary_reloption(bits32 kinds, const char *name, const char *desc,
939915 */
940916void
941917add_ternary_reloption (bits32 kinds , const char * name , const char * desc ,
942- ternary default_val , LOCKMODE lockmode )
918+ ternary default_val , const char * unset_alias , LOCKMODE lockmode )
943919{
944920 relopt_ternary * newoption = init_ternary_reloption (kinds , name , desc ,
945- default_val , lockmode );
921+ default_val , unset_alias , lockmode );
946922
947923 add_reloption ((relopt_gen * ) newoption );
948924}
@@ -956,11 +932,11 @@ add_ternary_reloption(bits32 kinds, const char *name, const char *desc,
956932void
957933add_local_ternary_reloption (local_relopts * relopts , const char * name ,
958934 const char * desc , ternary default_val ,
959- int offset )
935+ const char * unset_alias , int offset )
960936{
961937 relopt_ternary * newoption = init_ternary_reloption (RELOPT_KIND_LOCAL ,
962938 name , desc ,
963- default_val , 0 );
939+ default_val , unset_alias , 0 );
964940
965941 add_local_reloption (relopts , (relopt_gen * ) newoption , offset );
966942}
@@ -1701,8 +1677,19 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
17011677 case RELOPT_TYPE_TERNARY :
17021678 {
17031679 bool b ;
1680+ relopt_ternary * opt = (relopt_ternary * ) option -> gen ;
1681+
17041682 parsed = parse_bool (value , & b );
17051683 option -> values .ternary_val = b ? TERNARY_TRUE : TERNARY_FALSE ;
1684+
1685+ if (!parsed && opt -> unset_alias )
1686+ {
1687+ if (pg_strcasecmp (value , opt -> unset_alias ) == 0 )
1688+ {
1689+ option -> values .ternary_val = TERNARY_UNSET ;
1690+ parsed = true;
1691+ }
1692+ }
17061693 if (validate && !parsed )
17071694 ereport (ERROR ,
17081695 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
@@ -1999,7 +1986,7 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
19991986 offsetof(StdRdOptions , user_catalog_table )},
20001987 {"parallel_workers" , RELOPT_TYPE_INT ,
20011988 offsetof(StdRdOptions , parallel_workers )},
2002- {"vacuum_index_cleanup" , RELOPT_TYPE_ENUM ,
1989+ {"vacuum_index_cleanup" , RELOPT_TYPE_TERNARY ,
20031990 offsetof(StdRdOptions , vacuum_index_cleanup )},
20041991 {"vacuum_truncate" , RELOPT_TYPE_TERNARY ,
20051992 offsetof(StdRdOptions , vacuum_truncate )},
0 commit comments