From: Peter Eisentraut on
On tis, 2010-07-20 at 11:48 -0400, Robert Haas wrote:
> It's tempting to propose making .psqlrc apply only in interactive
> mode, period. But that would be an incompatibility with previous
> releases, and I'm not sure it's the behavior we want, either.

What is a use case for having .psqlrc be read in noninteractive use?


--
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: Robert Haas on
On Wed, Jul 21, 2010 at 10:24 AM, Peter Eisentraut <peter_e(a)gmx.net> wrote:
> On tis, 2010-07-20 at 11:48 -0400, Robert Haas wrote:
>> It's tempting to propose making .psqlrc apply only in interactive
>> mode, period. �But that would be an incompatibility with previous
>> releases, and I'm not sure it's the behavior we want, either.
>
> What is a use case for having .psqlrc be read in noninteractive use?

Well, for example, if I hate the new ASCII format with a fiery passion
that can never be quenched (and, by the way, I do), then I'd like this
to apply:

\pset linestyle old-ascii

Even when I do this:

psql -c '...whatever...'

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

--
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: David Christensen on

On Jul 21, 2010, at 9:42 AM, Robert Haas wrote:

> On Wed, Jul 21, 2010 at 10:24 AM, Peter Eisentraut <peter_e(a)gmx.net> wrote:
>> On tis, 2010-07-20 at 11:48 -0400, Robert Haas wrote:
>>> It's tempting to propose making .psqlrc apply only in interactive
>>> mode, period. But that would be an incompatibility with previous
>>> releases, and I'm not sure it's the behavior we want, either.
>>
>> What is a use case for having .psqlrc be read in noninteractive use?
>
> Well, for example, if I hate the new ASCII format with a fiery passion
> that can never be quenched (and, by the way, I do), then I'd like this
> to apply:
>
> \pset linestyle old-ascii
>
> Even when I do this:
>
> psql -c '...whatever...'


Well, tossing out two possible solutions:

1) .psqlrc + .psql_profile (kinda like how bash separates out the interactive/non-interactive parts). Kinda yucky, but it's a working solution.

2) have a flag which explicitly includes the psqlrc file in non-interactive use (perhaps if -x is available, use it for the analogue to -X).

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: Robert Haas on
On Wed, Jul 21, 2010 at 11:31 AM, David Christensen <david(a)endpoint.com> wrote:
>
> On Jul 21, 2010, at 9:42 AM, Robert Haas wrote:
>
>> On Wed, Jul 21, 2010 at 10:24 AM, Peter Eisentraut <peter_e(a)gmx.net> wrote:
>>> On tis, 2010-07-20 at 11:48 -0400, Robert Haas wrote:
>>>> It's tempting to propose making .psqlrc apply only in interactive
>>>> mode, period. �But that would be an incompatibility with previous
>>>> releases, and I'm not sure it's the behavior we want, either.
>>>
>>> What is a use case for having .psqlrc be read in noninteractive use?
>>
>> Well, for example, if I hate the new ASCII format with a fiery passion
>> that can never be quenched (and, by the way, I do), then I'd like this
>> to apply:
>>
>> \pset linestyle old-ascii
>>
>> Even when I do this:
>>
>> psql -c '...whatever...'
>
>
> Well, tossing out two possible solutions:
>
> 1) .psqlrc + .psql_profile (kinda like how bash separates out the interactive/non-interactive parts). �Kinda yucky, but it's a working solution.
>
> 2) have a flag which explicitly includes the psqlrc file in non-interactive use (perhaps if -x is available, use it for the analogue to -X).

Hmm. Well, that still doesn't solve the problem that -c and -f do
different things with respect to psqlrc, does it?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

--
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: Simon Riggs on
On Wed, 2010-07-21 at 17:24 +0300, Peter Eisentraut wrote:
> On tis, 2010-07-20 at 11:48 -0400, Robert Haas wrote:
> > It's tempting to propose making .psqlrc apply only in interactive
> > mode, period. But that would be an incompatibility with previous
> > releases, and I'm not sure it's the behavior we want, either.
>
> What is a use case for having .psqlrc be read in noninteractive use?

Changing the historical defaults, such as error/exit behaviour, ensuring
timing is on etc..

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Training and Services


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