@@ -1005,6 +1005,41 @@ static const pgsql_thing_t words_after_create[] = {
10051005 {NULL } /* end of list */
10061006};
10071007
1008+ /* Storage parameters for CREATE TABLE and ALTER TABLE */
1009+ static const char * const table_storage_parameters [] = {
1010+ "autovacuum_analyze_scale_factor" ,
1011+ "autovacuum_analyze_threshold" ,
1012+ "autovacuum_enabled" ,
1013+ "autovacuum_freeze_max_age" ,
1014+ "autovacuum_freeze_min_age" ,
1015+ "autovacuum_freeze_table_age" ,
1016+ "autovacuum_multixact_freeze_max_age" ,
1017+ "autovacuum_multixact_freeze_min_age" ,
1018+ "autovacuum_multixact_freeze_table_age" ,
1019+ "autovacuum_vacuum_cost_delay" ,
1020+ "autovacuum_vacuum_cost_limit" ,
1021+ "autovacuum_vacuum_scale_factor" ,
1022+ "autovacuum_vacuum_threshold" ,
1023+ "fillfactor" ,
1024+ "log_autovacuum_min_duration" ,
1025+ "parallel_workers" ,
1026+ "toast.autovacuum_enabled" ,
1027+ "toast.autovacuum_freeze_max_age" ,
1028+ "toast.autovacuum_freeze_min_age" ,
1029+ "toast.autovacuum_freeze_table_age" ,
1030+ "toast.autovacuum_multixact_freeze_max_age" ,
1031+ "toast.autovacuum_multixact_freeze_min_age" ,
1032+ "toast.autovacuum_multixact_freeze_table_age" ,
1033+ "toast.autovacuum_vacuum_cost_delay" ,
1034+ "toast.autovacuum_vacuum_cost_limit" ,
1035+ "toast.autovacuum_vacuum_scale_factor" ,
1036+ "toast.autovacuum_vacuum_threshold" ,
1037+ "toast.log_autovacuum_min_duration" ,
1038+ "toast_tuple_target" ,
1039+ "user_catalog_table" ,
1040+ NULL
1041+ };
1042+
10081043
10091044/* Forward declaration of functions */
10101045static char * * psql_completion (const char * text , int start , int end );
@@ -1904,44 +1939,7 @@ psql_completion(const char *text, int start, int end)
19041939 COMPLETE_WITH ("(" );
19051940 /* ALTER TABLE <foo> SET|RESET ( */
19061941 else if (Matches ("ALTER" , "TABLE" , MatchAny , "SET|RESET" , "(" ))
1907- {
1908- static const char * const list_TABLEOPTIONS [] =
1909- {
1910- "autovacuum_analyze_scale_factor" ,
1911- "autovacuum_analyze_threshold" ,
1912- "autovacuum_enabled" ,
1913- "autovacuum_freeze_max_age" ,
1914- "autovacuum_freeze_min_age" ,
1915- "autovacuum_freeze_table_age" ,
1916- "autovacuum_multixact_freeze_max_age" ,
1917- "autovacuum_multixact_freeze_min_age" ,
1918- "autovacuum_multixact_freeze_table_age" ,
1919- "autovacuum_vacuum_cost_delay" ,
1920- "autovacuum_vacuum_cost_limit" ,
1921- "autovacuum_vacuum_scale_factor" ,
1922- "autovacuum_vacuum_threshold" ,
1923- "fillfactor" ,
1924- "parallel_workers" ,
1925- "log_autovacuum_min_duration" ,
1926- "toast_tuple_target" ,
1927- "toast.autovacuum_enabled" ,
1928- "toast.autovacuum_freeze_max_age" ,
1929- "toast.autovacuum_freeze_min_age" ,
1930- "toast.autovacuum_freeze_table_age" ,
1931- "toast.autovacuum_multixact_freeze_max_age" ,
1932- "toast.autovacuum_multixact_freeze_min_age" ,
1933- "toast.autovacuum_multixact_freeze_table_age" ,
1934- "toast.autovacuum_vacuum_cost_delay" ,
1935- "toast.autovacuum_vacuum_cost_limit" ,
1936- "toast.autovacuum_vacuum_scale_factor" ,
1937- "toast.autovacuum_vacuum_threshold" ,
1938- "toast.log_autovacuum_min_duration" ,
1939- "user_catalog_table" ,
1940- NULL
1941- };
1942-
1943- COMPLETE_WITH_LIST (list_TABLEOPTIONS );
1944- }
1942+ COMPLETE_WITH_LIST (table_storage_parameters );
19451943 else if (Matches ("ALTER" , "TABLE" , MatchAny , "REPLICA" , "IDENTITY" , "USING" , "INDEX" ))
19461944 {
19471945 completion_info_charp = prev5_wd ;
@@ -2439,6 +2437,10 @@ psql_completion(const char *text, int start, int end)
24392437 else if (TailMatches ("CREATE" , "TEMP|TEMPORARY" , "TABLE" , MatchAny , "(*)" ))
24402438 COMPLETE_WITH ("INHERITS (" , "ON COMMIT" , "PARTITION BY" ,
24412439 "TABLESPACE" , "WITH (" );
2440+ /* Complete CREATE TABLE (...) WITH with storage parameters */
2441+ else if (TailMatches ("CREATE" , "TABLE" , MatchAny , "(*)" , "WITH" , "(" ) ||
2442+ TailMatches ("CREATE" , "TEMP|TEMPORARY|UNLOGGED" , "TABLE" , MatchAny , "(*)" , "WITH" , "(" ))
2443+ COMPLETE_WITH_LIST (table_storage_parameters );
24422444 /* Complete CREATE TABLE ON COMMIT with actions */
24432445 else if (TailMatches ("CREATE" , "TEMP|TEMPORARY" , "TABLE" , MatchAny , "(*)" , "ON" , "COMMIT" ))
24442446 COMPLETE_WITH ("DELETE ROWS" , "DROP" , "PRESERVE ROWS" );
0 commit comments