Skip to content

Commit 6f093f3

Browse files
committed
One-letter backslash commands now need a space before the first argument.
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>
1 parent 170e331 commit 6f093f3

File tree

3 files changed

+3
-45
lines changed

3 files changed

+3
-45
lines changed

src/bin/psql/command.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.186 2008/01/01 19:45:55 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.187 2008/05/02 09:27:50 petere Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -90,30 +90,6 @@ HandleSlashCmds(PsqlScanState scan_state,
9090
/* And try to execute it */
9191
status = exec_command(cmd, scan_state, query_buf);
9292

93-
if (status == PSQL_CMD_UNKNOWN && strlen(cmd) > 1)
94-
{
95-
/*
96-
* If the command was not recognized, try to parse it as a one-letter
97-
* command with immediately following argument (a still-supported, but
98-
* no longer encouraged, syntax).
99-
*/
100-
char new_cmd[2];
101-
102-
/* don't change cmd until we know it's okay */
103-
new_cmd[0] = cmd[0];
104-
new_cmd[1] = '\0';
105-
106-
psql_scan_slash_pushback(scan_state, cmd + 1);
107-
108-
status = exec_command(new_cmd, scan_state, query_buf);
109-
110-
if (status != PSQL_CMD_UNKNOWN)
111-
{
112-
/* adjust cmd for possible messages below */
113-
cmd[1] = '\0';
114-
}
115-
}
116-
11793
if (status == PSQL_CMD_UNKNOWN)
11894
{
11995
if (pset.cur_cmd_interactive)

src/bin/psql/psqlscan.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.h,v 1.8 2008/01/01 19:45:56 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.h,v 1.9 2008/05/02 09:27:51 petere Exp $
77
*/
88
#ifndef PSQLSCAN_H
99
#define PSQLSCAN_H
@@ -61,6 +61,4 @@ extern char *psql_scan_slash_option(PsqlScanState state,
6161

6262
extern void psql_scan_slash_command_end(PsqlScanState state);
6363

64-
extern void psql_scan_slash_pushback(PsqlScanState state, const char *str);
65-
6664
#endif /* PSQLSCAN_H */

src/bin/psql/psqlscan.l

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Portions Copyright (c) 1994, Regents of the University of California
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.23 2008/01/01 19:45:56 momjian Exp $
36+
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.24 2008/05/02 09:27:51 petere Exp $
3737
*
3838
*-------------------------------------------------------------------------
3939
*/
@@ -1525,22 +1525,6 @@ psql_scan_slash_command_end(PsqlScanState state)
15251525
/* There are no possible errors in this lex state... */
15261526
}
15271527

1528-
/*
1529-
* "Push back" the passed string so that it will be rescanned by subsequent
1530-
* psql_scan_slash_option calls. This is presently only used in the case
1531-
* where a single-letter command has been concatenated with its argument.
1532-
*
1533-
* We use the same buffer stack mechanism as for variable expansion.
1534-
*/
1535-
void
1536-
psql_scan_slash_pushback(PsqlScanState state, const char *str)
1537-
{
1538-
/* needed for push_new_buffer */
1539-
cur_state = state;
1540-
1541-
push_new_buffer(str);
1542-
}
1543-
15441528

15451529
/*
15461530
* Push the given string onto the stack of stuff to scan.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy