<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.143 2005/06/13 02:40:08 neilc Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.144 2005/06/13 06:36:22 neilc Exp $
PostgreSQL documentation
-->
<term><option>--expanded</></term>
<listitem>
<para>
- Turn on the extended table formatting mode. This is equivalent to the
- command <command>\x</command>.
+ Turn on the expanded table formatting mode. This is equivalent to the
+ <command>\x</command> command.
</para>
</listitem>
</varlistentry>
<literal>aligned</literal>, <literal>html</literal>,
<literal>latex</literal>, or <literal>troff-ms</literal>.
Unique abbreviations are allowed. (That would mean one letter
- is enough.)
+ is enough.)
</para>
<para>
<listitem>
<para>
Toggles between regular and expanded format. When expanded
- format is enabled, all output has two columns with the column
- name on the left and the data on the right. This mode is
- useful if the data wouldn't fit on the screen in the normal
- <quote>horizontal</quote> mode.
+ format is enabled, query results are displayed in two
+ columns, with the column name on the left and the data on
+ the right. This option only affects how normal query results
+ are displayed; the output of <application>psql</application>
+ meta-commands is always presented using the regular
+ format. This mode is useful if the data wouldn't fit on the
+ screen in the normal <quote>horizontal</quote> mode.
</para>
<para>
<term><literal>\x</literal></term>
<listitem>
<para>
- Toggles extended table formatting mode. As such it is equivalent to
+ Toggles expanded table formatting mode. As such it is equivalent to
<literal>\pset expanded</literal>.
</para>
</listitem>
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.100 2005/06/10 14:49:31 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.101 2005/06/13 06:36:22 neilc Exp $
*/
#include "postgres_fe.h"
#include "common.h"
static bool command_no_begin(const char *query);
-
/*
* "Safe" wrapper around strdup()
*/
*
*/
void
-psql_error(const char *fmt,...)
+psql_error(const char *fmt, ...)
{
va_list ap;
static bool
PrintQueryTuples(const PGresult *results)
{
+ printQueryOpt my_popt = pset.popt;
+
+ my_popt.topt.normal_query = true;
+
/* write output to \g argument, if any */
if (pset.gfname)
{
return false;
}
- printQuery(results, &pset.popt, pset.queryFout);
+ printQuery(results, &my_popt, pset.queryFout);
/* close file/pipe, restore old setting */
setQFout(NULL);
pset.gfname = NULL;
}
else
- printQuery(results, &pset.popt, pset.queryFout);
+ printQuery(results, &my_popt, pset.queryFout);
return true;
}
if (on_error_rollback_warning == false && pset.sversion < 80000)
{
fprintf(stderr, _("The server version (%d) does not support savepoints for ON_ERROR_ROLLBACK.\n"),
- pset.sversion);
+ pset.sversion);
on_error_rollback_warning = true;
}
else
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.57 2005/06/09 18:40:06 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.58 2005/06/13 06:36:22 neilc Exp $
*/
#include "postgres_fe.h"
#include "common.h"
#include "mbprint.h"
-
/*************************/
/* Unaligned text */
/*************************/
const char *default_footer[] = {NULL};
unsigned short int border = opt->border;
FILE *output;
+ bool use_expanded;
if (opt->format == PRINT_NOTHING)
return;
if (opt->format != PRINT_HTML && border > 2)
border = 2;
+ /*
+ * We only want to display the results in "expanded" format if
+ * this is a normal (user-submitted) query, not a table we're
+ * printing for a slash command.
+ */
+ if (opt->expanded && opt->normal_query)
+ use_expanded = true;
+ else
+ use_expanded = false;
+
if (fout == stdout)
{
int col_count = 0,
switch (opt->format)
{
case PRINT_UNALIGNED:
- if (opt->expanded)
- print_unaligned_vertical(title, headers, cells, footers, opt->fieldSep, opt->recordSep, opt->tuples_only, output);
+ if (use_expanded)
+ print_unaligned_vertical(title, headers, cells, footers,
+ opt->fieldSep, opt->recordSep,
+ opt->tuples_only, output);
else
- print_unaligned_text(title, headers, cells, footers, opt->fieldSep, opt->recordSep, opt->tuples_only, output);
+ print_unaligned_text(title, headers, cells, footers,
+ opt->fieldSep, opt->recordSep,
+ opt->tuples_only, output);
break;
case PRINT_ALIGNED:
- if (opt->expanded)
- print_aligned_vertical(title, headers, cells, footers, opt->tuples_only, border, opt->encoding, output);
+ if (use_expanded)
+ print_aligned_vertical(title, headers, cells, footers,
+ opt->tuples_only, border,
+ opt->encoding, output);
else
- print_aligned_text(title, headers, cells, footers, align, opt->tuples_only, border, opt->encoding, output);
+ print_aligned_text(title, headers, cells, footers,
+ align, opt->tuples_only,
+ border, opt->encoding, output);
break;
case PRINT_HTML:
- if (opt->expanded)
- print_html_vertical(title, headers, cells, footers, align, opt->tuples_only, border, opt->tableAttr, output);
+ if (use_expanded)
+ print_html_vertical(title, headers, cells, footers,
+ align, opt->tuples_only,
+ border, opt->tableAttr, output);
else
- print_html_text(title, headers, cells, footers, align, opt->tuples_only, border, opt->tableAttr, output);
+ print_html_text(title, headers, cells, footers,
+ align, opt->tuples_only, border,
+ opt->tableAttr, output);
break;
case PRINT_LATEX:
- if (opt->expanded)
- print_latex_vertical(title, headers, cells, footers, align, opt->tuples_only, border, output);
+ if (use_expanded)
+ print_latex_vertical(title, headers, cells, footers, align,
+ opt->tuples_only, border, output);
else
- print_latex_text(title, headers, cells, footers, align, opt->tuples_only, border, output);
+ print_latex_text(title, headers, cells, footers, align,
+ opt->tuples_only, border, output);
break;
case PRINT_TROFF_MS:
- if (opt->expanded)
- print_troff_ms_vertical(title, headers, cells, footers, align, opt->tuples_only, border, output);
+ if (use_expanded)
+ print_troff_ms_vertical(title, headers, cells, footers,
+ align, opt->tuples_only,
+ border, output);
else
- print_troff_ms_text(title, headers, cells, footers, align, opt->tuples_only, border, output);
+ print_troff_ms_text(title, headers, cells, footers,
+ align, opt->tuples_only,
+ border, output);
break;
default:
- fprintf(stderr, "+ Oops, you shouldn't see this!\n");
+ fprintf(stderr, _("illegal output format: %d"), opt->format);
+ exit(EXIT_FAILURE);
}
/* Only close if we used the pager */