[PATCH] Clarify that "psql -c" ignores psqlrc files - Mailing list pgsql-docs

From Tim Landscheidt
Subject [PATCH] Clarify that "psql -c" ignores psqlrc files
Date
Msg-id m3k4p8944w.fsf_-_@passepartout.tim-landscheidt.de
Whole thread Raw
Responses Re: [PATCH] Clarify that "psql -c" ignores psqlrc files  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-docs
Balkrishna Sharma <b_ki@hotmail.com> wrote on -admin:

> Thanks. If I want to do at system-wide level, where do I store the psqlrc file (assuming I want to change the timing
behaviorsystem-wide)? 
> (CentOS 5, Postgres 8.4)
> $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
> But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just creating the directory and putting a psqlrc file
overthere does not seem to work. 

> On a side-note, I observered that timing value in ~/.psqlrc was ignored by psql -c "..." command but not by echo
"...."|psqlThoughtit was strange. 
> [...]

Patch attached to clarify the latter.

Tim
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index df06517..4f3ef5c 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -79,7 +79,9 @@ PostgreSQL documentation
       <para>
       Specifies that <application>psql</application> is to execute one
       command string, <replaceable class="parameter">command</replaceable>,
-      and then exit. This is useful in shell scripts.
+      and then exit. This is useful in shell scripts. Start-up files
+      (<filename>psqlrc</filename> and <filename>~/.psqlrc</filename>) are
+      ignored with this option.
       </para>
       <para>
       <replaceable class="parameter">command</replaceable> must be either
@@ -3090,10 +3092,12 @@ $endif
   <itemizedlist>
    <listitem>
     <para>
-     Before starting up, <application>psql</application> attempts to
+     Unless it is passed an <option>-X</option>
+     or <option>-c</option> option,
+     <application>psql</application> attempts to
      read and execute commands from the system-wide
      <filename>psqlrc</filename> file and the user's
-     <filename>~/.psqlrc</filename> file.
+     <filename>~/.psqlrc</filename> file before starting up.
      (On Windows, the user's startup file is named
      <filename>%APPDATA%\postgresql\psqlrc.conf</filename>.)
      See <filename><replaceable>PREFIX</>/share/psqlrc.sample</>

pgsql-docs by date:

Previous
From: Satoshi Nagayasu
Date:
Subject: Re: [INTERFACES] ECPG Documentation Improvement
Next
From: Tim Landscheidt
Date:
Subject: Re: "Localizing" paths?