1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Rethink \crosstabview's argument parsing logic.

\crosstabview interpreted its arguments in an unusual way, including
doing case-insensitive matching of unquoted column names, which is
surely not the right thing.  Rip that out in favor of doing something
equivalent to the dequoting/case-folding rules used by other psql
commands.  To keep it simple, change the syntax so that the optional
sort column is specified as a separate argument, instead of the
also-quite-unusual syntax that attached it to the colH argument with
a colon.

Also, rework the error messages to be closer to project style.
This commit is contained in:
Tom Lane
2016-04-14 22:54:26 -04:00
parent 4b74c6a40e
commit 6f0d6a5078
7 changed files with 157 additions and 292 deletions

View File

@ -368,13 +368,11 @@ exec_command(const char *cmd,
/* \crosstabview -- execute a query and display results in crosstab */
else if (strcmp(cmd, "crosstabview") == 0)
{
pset.ctv_col_V = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, false);
pset.ctv_col_H = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, false);
pset.ctv_col_D = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, false);
int i;
for (i = 0; i < lengthof(pset.ctv_args); i++)
pset.ctv_args[i] = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, true);
pset.crosstab_flag = true;
status = PSQL_CMD_SEND;
}