From: David Christensen on

On Mar 4, 2010, at 4:00 PM, Magnus Hagander wrote:

> I've now for the second time found myself wanting to specify an
> explicit psqlrc file instead of just parsing ~/.psqlrc, so attached is
> a patch that accepts the PSQLRC environment variable to control which
> psqlrc file is used.
>
> Any objections to this (obviously including documentation - this is
> just the trivial code)


My bikeshed has a --psqlrc path/to/file, but +1 on the idea.

Regards,

David
--
David Christensen
End Point Corporation
david(a)endpoint.com





--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Magnus Hagander on
2010/3/5 David Christensen <david(a)endpoint.com>:
>
> On Mar 4, 2010, at 4:00 PM, Magnus Hagander wrote:
>
>> I've now for the second time found myself wanting to specify an
>> explicit psqlrc file instead of just parsing ~/.psqlrc, so attached is
>> a patch that accepts the PSQLRC environment variable to control which
>> psqlrc file is used.
>>
>> Any objections to this (obviously including documentation - this is
>> just the trivial code)
>
>
> My bikeshed has a --psqlrc path/to/file, but +1 on the idea.

The main reason I went with environment variable is that it's the
path-of-least-code :-) And it easily fullfills my use-cases for it,
which has me launching interactive psql with completely different
settings from a script.

Do you have a use-case where --psqlrc would be more useful than an
environment variable, or is it *only* bike-shedding? ;)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Magnus Hagander on
2010/3/5 Magnus Hagander <magnus(a)hagander.net>:
> 2010/3/5 David Christensen <david(a)endpoint.com>:
>>
>> On Mar 4, 2010, at 4:00 PM, Magnus Hagander wrote:
>>
>>> I've now for the second time found myself wanting to specify an
>>> explicit psqlrc file instead of just parsing ~/.psqlrc, so attached is
>>> a patch that accepts the PSQLRC environment variable to control which
>>> psqlrc file is used.
>>>
>>> Any objections to this (obviously including documentation - this is
>>> just the trivial code)
>>
>>
>> My bikeshed has a --psqlrc path/to/file, but +1 on the idea.
>
> The main reason I went with environment variable is that it's the
> path-of-least-code :-) And it easily fullfills my use-cases for it,
> which has me launching interactive psql with completely different
> settings from a script.
>
> Do you have a use-case where --psqlrc would be more useful than an
> environment variable, or is it *only* bike-shedding? ;)

Just to be clear, the code difference isn't very large. Attached is a
patch that does both PSQLRC and --psqlrc.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
From: Tom Lane on
Magnus Hagander <magnus(a)hagander.net> writes:
> 2010/3/5 David Christensen <david(a)endpoint.com>:
>> My bikeshed has a --psqlrc path/to/file, but +1 on the idea.

> Do you have a use-case where --psqlrc would be more useful than an
> environment variable, or is it *only* bike-shedding? ;)

The env variable solution seems a bit surprising to me. If we were
dealing with a libpq option it would make sense (to avoid having to pass
the info through other layers) but for a psql option it doesn't AFAICS.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Magnus Hagander on
2010/3/5 Tom Lane <tgl(a)sss.pgh.pa.us>:
> Magnus Hagander <magnus(a)hagander.net> writes:
>> 2010/3/5 David Christensen <david(a)endpoint.com>:
>>> My bikeshed has a --psqlrc path/to/file, but +1 on the idea.
>
>> Do you have a use-case where --psqlrc would be more useful than an
>> environment variable, or is it *only* bike-shedding? ;)
>
> The env variable solution seems a bit surprising to me.  If we were
> dealing with a libpq option it would make sense (to avoid having to pass
> the info through other layers) but for a psql option it doesn't AFAICS.

Fair enough. It worked in my environment, but I can see your point. So
I'll just strip that part out then :)


--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers