@@ -1622,12 +1622,12 @@ psql_completion(char *text, int start, int end)
16221622 COMPLETE_WITH_CONST ("IDENTITY" );
16231623 }
16241624
1625- /* ALTER TABLESPACE <foo> with RENAME TO, OWNER TO, SET, RESET */
1625+ /* ALTER TABLESPACE <foo> with RENAME TO, OWNER TO, SET, RESET, MOVE */
16261626 else if (pg_strcasecmp (prev3_wd , "ALTER" ) == 0 &&
16271627 pg_strcasecmp (prev2_wd , "TABLESPACE" ) == 0 )
16281628 {
16291629 static const char * const list_ALTERTSPC [] =
1630- {"RENAME TO" , "OWNER TO" , "SET" , "RESET" , NULL };
1630+ {"RENAME TO" , "OWNER TO" , "SET" , "RESET" , "MOVE" , NULL };
16311631
16321632 COMPLETE_WITH_LIST (list_ALTERTSPC );
16331633 }
@@ -1649,6 +1649,27 @@ psql_completion(char *text, int start, int end)
16491649
16501650 COMPLETE_WITH_LIST (list_TABLESPACEOPTIONS );
16511651 }
1652+ /* ALTER TABLESPACE <foo> MOVE ALL|TABLES|INDEXES|MATERIALIZED VIEWS */
1653+ else if (pg_strcasecmp (prev4_wd , "ALTER" ) == 0 &&
1654+ pg_strcasecmp (prev3_wd , "TABLESPACE" ) == 0 &&
1655+ pg_strcasecmp (prev_wd , "MOVE" ) == 0 )
1656+ {
1657+ static const char * const list_TABLESPACEMOVETARGETS [] =
1658+ {"ALL" , "TABLES" , "INDEXES" , "MATERIALIZED VIEWS" , NULL };
1659+
1660+ COMPLETE_WITH_LIST (list_TABLESPACEMOVETARGETS );
1661+ }
1662+ else if ((pg_strcasecmp (prev4_wd , "TABLESPACE" ) == 0 &&
1663+ pg_strcasecmp (prev2_wd , "MOVE" ) == 0 ) ||
1664+ (pg_strcasecmp (prev5_wd , "TABLESPACE" ) == 0 &&
1665+ pg_strcasecmp (prev3_wd , "MOVE" ) == 0 &&
1666+ pg_strcasecmp (prev2_wd , "MATERIALIZED" ) == 0 ))
1667+ {
1668+ static const char * const list_TABLESPACEMOVEOPTIONS [] =
1669+ {"OWNED BY" , "TO" , NULL };
1670+
1671+ COMPLETE_WITH_LIST (list_TABLESPACEMOVEOPTIONS );
1672+ }
16521673
16531674 /* ALTER TEXT SEARCH */
16541675 else if (pg_strcasecmp (prev3_wd , "ALTER" ) == 0 &&
@@ -2559,8 +2580,9 @@ psql_completion(char *text, int start, int end)
25592580 * but we may as well tab-complete both: perhaps some users prefer one
25602581 * variant or the other.
25612582 */
2562- else if (pg_strcasecmp (prev3_wd , "FETCH" ) == 0 ||
2563- pg_strcasecmp (prev3_wd , "MOVE" ) == 0 )
2583+ else if ((pg_strcasecmp (prev3_wd , "FETCH" ) == 0 ||
2584+ pg_strcasecmp (prev3_wd , "MOVE" ) == 0 ) &&
2585+ pg_strcasecmp (prev_wd , "TO" ) != 0 )
25642586 {
25652587 static const char * const list_FROMIN [] =
25662588 {"FROM" , "IN" , NULL };
0 commit comments