Hi

2017-08-16 6:58 GMT+02:00 Thomas Munro <thomas.mu...@enterprisedb.com>:

> On Thu, Jul 27, 2017 at 4:19 AM, Pavel Stehule <pavel.steh...@gmail.com>
> wrote:
> > here is a patch - it is trivial
>
> The feature makes sense, follows an existing example (PSQL_EDITOR),
> and works nicely.
>
>        is platform-dependent.  Use of the pager can be disabled by setting
>        <envar>PAGER</envar> to empty, or by using pager-related options of
>
> Maybe this should now say "... can be disabled by specifying an empty
> string", since "... by setting PAGER to empty" isn't quite the full
> story.
>
> -      the <command>\pset</command> command.
> +      the <command>\pset</command> command. These variables are examined
> +      in the order listed; the first that is set is used.
>       </para>
> +
>
> Stray blank line.
>

I am not sure if I see last issue well. Sending updated patch

Regards

Pavel


>
> --
> Thomas Munro
> http://www.enterprisedb.com
>
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index c592edac60..fbce45b90e 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -4087,17 +4087,20 @@ $endif
    </varlistentry>
 
    <varlistentry>
+    <term><envar>PSQL_PAGER</envar></term>
     <term><envar>PAGER</envar></term>
 
     <listitem>
      <para>
       If the query results do not fit on the screen, they are piped
-      through this command.  Typical values are
-      <literal>more</literal> or <literal>less</literal>.  The default
-      is platform-dependent.  Use of the pager can be disabled by setting
-      <envar>PAGER</envar> to empty, or by using pager-related options of
-      the <command>\pset</command> command.
+      through this command. Typical values are <literal>more</literal>
+      or <literal>less</literal>. The default is platform-dependent.
+      Use of the pager can be disabled by setting <envar>PSQL_PAGER</envar>
+      or <envar>PAGER</envar> to empty string, or by using pager-related
+      options of the <command>\pset</command> command. These variables
+      are examined in the order listed; the first that is set is used.
      </para>
+
     </listitem>
    </varlistentry>
 
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index b3dbb5946e..9b0b83b0bd 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -411,7 +411,7 @@ helpVariables(unsigned short int pager)
 #endif
 
 	fprintf(output, _("  COLUMNS            number of columns for wrapped format\n"));
-	fprintf(output, _("  PAGER              name of external pager program\n"));
+	fprintf(output, _("  PSQL_PAGER, PAGER  name of external pager program\n"));
 	fprintf(output, _("  PGAPPNAME          same as the application_name connection parameter\n"));
 	fprintf(output, _("  PGDATABASE         same as the dbname connection parameter\n"));
 	fprintf(output, _("  PGHOST             same as the host connection parameter\n"));
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
index f756f767e5..8af5bbe97e 100644
--- a/src/fe_utils/print.c
+++ b/src/fe_utils/print.c
@@ -2870,7 +2870,9 @@ PageOutput(int lines, const printTableOpt *topt)
 			const char *pagerprog;
 			FILE	   *pagerpipe;
 
-			pagerprog = getenv("PAGER");
+			pagerprog = getenv("PSQL_PAGER");
+			if (!pagerprog)
+				pagerprog = getenv("PAGER");
 			if (!pagerprog)
 				pagerprog = DEFAULT_PAGER;
 			else
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to