summaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 7c9f28dee06..e64c033bf8c 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1071,7 +1071,8 @@ exec_command(const char *cmd,
static const char *const my_list[] = {
"border", "columns", "expanded", "fieldsep", "fieldsep_zero",
"footer", "format", "linestyle", "null",
- "numericlocale", "pager", "recordsep", "recordsep_zero",
+ "numericlocale", "pager", "pager_min_lines",
+ "recordsep", "recordsep_zero",
"tableattr", "title", "tuples_only",
"unicode_border_linestyle",
"unicode_column_linestyle",
@@ -1265,7 +1266,7 @@ exec_command(const char *cmd,
lines++;
}
- output = PageOutput(lineno, pset.popt.topt.pager);
+ output = PageOutput(lineno, &(pset.popt.topt));
is_pager = true;
}
else
@@ -2519,6 +2520,13 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
popt->topt.pager = 1;
}
+ /* set minimum lines for pager use */
+ else if (strcmp(param, "pager_min_lines") == 0)
+ {
+ if (value)
+ popt->topt.pager_min_lines = atoi(value);
+ }
+
/* disable "(x rows)" footer */
else if (strcmp(param, "footer") == 0)
{
@@ -2640,6 +2648,13 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
printf(_("Pager usage is off.\n"));
}
+ /* show minimum lines for pager use */
+ else if (strcmp(param, "pager_min_lines") == 0)
+ {
+ printf(_("Pager won't be used for less than %d lines\n"),
+ popt->topt.pager_min_lines);
+ }
+
/* show record separator for unaligned text */
else if (strcmp(param, "recordsep") == 0)
{
@@ -2792,6 +2807,8 @@ pset_value_string(const char *param, struct printQueryOpt *popt)
return pstrdup(pset_bool_string(popt->topt.numericLocale));
else if (strcmp(param, "pager") == 0)
return psprintf("%d", popt->topt.pager);
+ else if (strcmp(param, "pager_min_lines") == 0)
+ return psprintf("%d", popt->topt.pager_min_lines);
else if (strcmp(param, "recordsep") == 0)
return pset_quoted_string(popt->topt.recordSep.separator
? popt->topt.recordSep.separator