summaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-04-14 22:54:26 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-04-14 22:54:31 -0400
commit6f0d6a507889d94a79c0d18577a0cb1ccc2b6815 (patch)
tree0ee0bfe10f064a942bd5bb7f99afd5311a1809dd /src/bin/psql/common.c
parent4b74c6a40e7ac9dad7cdeb4cfd2d51ea60cfdbb5 (diff)
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.
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 437cb568234..2c0d781302c 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1130,6 +1130,7 @@ SendQuery(const char *query)
PGTransactionStatusType transaction_status;
double elapsed_msec = 0;
bool OK = false;
+ int i;
bool on_error_rollback_savepoint = false;
static bool on_error_rollback_warning = false;
@@ -1362,20 +1363,10 @@ sendquery_cleanup:
/* reset \crosstabview trigger */
pset.crosstab_flag = false;
- if (pset.ctv_col_V)
+ for (i = 0; i < lengthof(pset.ctv_args); i++)
{
- free(pset.ctv_col_V);
- pset.ctv_col_V = NULL;
- }
- if (pset.ctv_col_H)
- {
- free(pset.ctv_col_H);
- pset.ctv_col_H = NULL;
- }
- if (pset.ctv_col_D)
- {
- free(pset.ctv_col_D);
- pset.ctv_col_D = NULL;
+ pg_free(pset.ctv_args[i]);
+ pset.ctv_args[i] = NULL;
}
return OK;