Thread: NT tab complete patch

NT tab complete patch

From
Gaetano Mendola
Date:
Hi all,
I'm trying the savepoint-5.patch

Using the psql the TAB autocomplete doesn't work for savepoint and for release commands,
also the ROLLBACK doesn't know yet the ROLLBACK TO sintax.

Attached the patch that solve these issues.

BTW, there is a way to know which savepoint are active ?



Regards
Gaetano Mendola




--- pgsql_patched/src/bin/psql/tab-complete.c    2004-07-19 17:21:50.000000000 +0200
+++ pgsql/src/bin/psql/tab-complete.c    2004-05-26 15:56:55.000000000 +0200
@@ -463,8 +463,8 @@
         "ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT",
         "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE", "DELETE", "DROP", "EXECUTE",
         "EXPLAIN", "FETCH", "GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY",
-        "PREPARE", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK", "SAVEPOINT",
-                "SELECT", "SET", "SHOW", "START", "TRUNCATE", "UNLISTEN", "UPDATE", "VACUUM", NULL
+        "PREPARE", "REINDEX", "RESET", "REVOKE", "ROLLBACK", "SELECT", "SET", "SHOW", "START",
+        "TRUNCATE", "UNLISTEN", "UPDATE", "VACUUM", NULL
     };

     static const char * const pgsql_variables[] = {
@@ -726,6 +726,7 @@
     else if (pg_strcasecmp(prev_wd, "BEGIN") == 0 ||
              pg_strcasecmp(prev_wd, "END") == 0 ||
              pg_strcasecmp(prev_wd, "COMMIT") == 0 ||
+             pg_strcasecmp(prev_wd, "ROLLBACK") == 0 ||
              pg_strcasecmp(prev_wd, "ABORT") == 0)
     {
         static const char * const list_TRANS[] =
@@ -733,14 +734,6 @@

         COMPLETE_WITH_LIST(list_TRANS);
     }
-/* ROLLBACK*/
-    else if ( pg_strcasecmp(prev_wd, "ROLLBACK") == 0 )
-    {
-        static const char * const list_TRANS[] =
-        {"WORK", "TRANSACTION", "TO", NULL};
-
-        COMPLETE_WITH_LIST(list_TRANS);
-    }
 /* CLUSTER */
     /* If the previous word is CLUSTER, produce list of indexes. */
     else if (pg_strcasecmp(prev_wd, "CLUSTER") == 0)