One-letter backslash commands now need a space before the first argument.
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 2 May 2008 09:27:51 +0000 (09:27 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 2 May 2008 09:27:51 +0000 (09:27 +0000)
This has been the only documented and encouraged syntax for a long time, and
with extension facilities such as aliases being proposed, it is a good time to
clean up the legacy syntax a bit.

Author: Bernd Helmle <mailings@oopsware.de>

src/bin/psql/command.c
src/bin/psql/psqlscan.h
src/bin/psql/psqlscan.l

index 3e6f1bc58f0bb037592ce03ecf73faf61804a47d..28a14c7d0aef5fc7844271e142310f3232127dc9 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2008, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.186 2008/01/01 19:45:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.187 2008/05/02 09:27:50 petere Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -90,30 +90,6 @@ HandleSlashCmds(PsqlScanState scan_state,
    /* And try to execute it */
    status = exec_command(cmd, scan_state, query_buf);
 
-   if (status == PSQL_CMD_UNKNOWN && strlen(cmd) > 1)
-   {
-       /*
-        * If the command was not recognized, try to parse it as a one-letter
-        * command with immediately following argument (a still-supported, but
-        * no longer encouraged, syntax).
-        */
-       char        new_cmd[2];
-
-       /* don't change cmd until we know it's okay */
-       new_cmd[0] = cmd[0];
-       new_cmd[1] = '\0';
-
-       psql_scan_slash_pushback(scan_state, cmd + 1);
-
-       status = exec_command(new_cmd, scan_state, query_buf);
-
-       if (status != PSQL_CMD_UNKNOWN)
-       {
-           /* adjust cmd for possible messages below */
-           cmd[1] = '\0';
-       }
-   }
-
    if (status == PSQL_CMD_UNKNOWN)
    {
        if (pset.cur_cmd_interactive)
index 860e68e3e4c8cfd414f8a089db3e05e201820226..933f9eb128b45705f7a3825d2441d9e556c665b2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2008, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/psqlscan.h,v 1.8 2008/01/01 19:45:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/psqlscan.h,v 1.9 2008/05/02 09:27:51 petere Exp $
  */
 #ifndef PSQLSCAN_H
 #define PSQLSCAN_H
@@ -61,6 +61,4 @@ extern char *psql_scan_slash_option(PsqlScanState state,
 
 extern void psql_scan_slash_command_end(PsqlScanState state);
 
-extern void psql_scan_slash_pushback(PsqlScanState state, const char *str);
-
 #endif   /* PSQLSCAN_H */
index edfb90abb4f8228d25a573cb9d77d7f8a399b10c..07c31aa36a7d90d8db826b1463744e5829dc52b6 100644 (file)
@@ -33,7 +33,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.23 2008/01/01 19:45:56 momjian Exp $
+ *   $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.24 2008/05/02 09:27:51 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1525,22 +1525,6 @@ psql_scan_slash_command_end(PsqlScanState state)
    /* There are no possible errors in this lex state... */
 }
 
-/*
- * "Push back" the passed string so that it will be rescanned by subsequent
- * psql_scan_slash_option calls.  This is presently only used in the case
- * where a single-letter command has been concatenated with its argument.
- *
- * We use the same buffer stack mechanism as for variable expansion.
- */
-void
-psql_scan_slash_pushback(PsqlScanState state, const char *str)
-{
-   /* needed for push_new_buffer */
-   cur_state = state;
-
-   push_new_buffer(str);
-}
-
 
 /*
  * Push the given string onto the stack of stuff to scan.