Re: PSQLRC environment variable.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: James Tanis <jtt(at)sysd(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: PSQLRC environment variable.
Date: 2004-03-09 23:46:55
Message-ID: 200403092346.i29Nkt108254@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Seems like a nice feature to me.

---------------------------------------------------------------------------

James Tanis wrote:
>
> In the tradition of telnet, xinit, and others, I've created a patch which
> allows users to override the location of .psqlrc by setting the PSQLRC
> environment variable. I occurs to me that you have probably considered this
> and the fact that it is not implemented suggests that you have rejected the
> idea, but I needed it and I figured it couldn't hurt to pass it along.
>
> PSQLRC overrides $HOME/.psqlrc and, as with $HOME/.psqlrc, if there is an
> error accessing the file, the function just returns having done nothing.
>
> Cheers,
> /jtt
> jtt(at)sysd(dot)com
>
>
> ----------------------------------------------------------------
> Index: startup.c
> ===================================================================
> RCS file: /src/cvs/postgres/src/bin/psql/startup.c,v
> retrieving revision 1.1.1.4
> diff -u -r1.1.1.4 startup.c
> --- startup.c 16 Dec 2003 22:15:32 -0000 1.1.1.4
> +++ startup.c 7 Mar 2004 15:15:54 -0000
> @@ -561,7 +561,12 @@
> #ifdef WIN32
> #define R_OK 0
> #endif
> -
> + if ((psqlrc = getenv("PSQLRC")))
> + {
> + if (access(psqlrc, R_OK) == 0)
> + process_file(psqlrc);
> + return;
> + }
> /* Look for one in the home dir */
> home = getenv("HOME");
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-03-09 23:58:55 Re: PSQLRC environment variable.
Previous Message Lee Kindness 2004-03-09 22:28:09 Re: ECPG - Specifying connections, TSD, sqlca.