@@ -761,6 +761,17 @@ psql_completion(char *text, int start, int end)
761761if (text [0 ]== '\\' )
762762COMPLETE_WITH_LIST (backslash_commands );
763763
764+ /* Variable interpolation */
765+ else if (text [0 ]== ':' && text [1 ]!= ':' )
766+ {
767+ if (text [1 ]== '\'' )
768+ matches = complete_from_variables (text ,":'" ,"'" );
769+ else if (text [1 ]== '"' )
770+ matches = complete_from_variables (text ,":\"" ,"\"" );
771+ else
772+ matches = complete_from_variables (text ,":" ,"" );
773+ }
774+
764775/* If no previous word, suggest one of the basic sql commands */
765776else if (!prev_wd )
766777COMPLETE_WITH_LIST (sql_commands );
@@ -2772,17 +2783,6 @@ psql_completion(char *text, int start, int end)
27722783)
27732784matches = completion_matches (text ,filename_completion_function );
27742785
2775- /* Variable interpolation */
2776- else if (text [0 ]== ':' && text [1 ]!= ':' )
2777- {
2778- if (text [1 ]== '\'' )
2779- matches = complete_from_variables (text ,":'" ,"'" );
2780- else if (text [1 ]== '"' )
2781- matches = complete_from_variables (text ,":\"" ,"\"" );
2782- else
2783- matches = complete_from_variables (text ,":" ,"" );
2784- }
2785-
27862786/*
27872787 * Finally, we look through the list of "things", such as TABLE, INDEX and
27882788 * check if that was the previous word. If so, execute the query to get a