Re: proposal: multiple psql option -c

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, dinesh kumar <dineshkumar02(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: multiple psql option -c
Date: 2015-08-29 04:39:35
Message-ID: CAFj8pRC4_6A3PsM6RwriBu9By1EEm+q7F5Ah1Afhj0oyWn2BwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-08-28 22:31 GMT+02:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Fri, Aug 28, 2015 at 4:18 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
>
>>
>>
>> 2015-08-28 22:07 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:
>>
>>> On 8/26/15 8:15 AM, Pavel Stehule wrote:
>>>
>>>> + and then exit. This is useful in shell scripts. Start-up files
>>>> + (<filename>psqlrc</filename> and <filename>~/.psqlrc</filename>)
>>>> are
>>>> + ignored with this option.
>>>>
>>>
>>> Sorry if this was discussed and I missed it, but I think this is a bad
>>> idea. There's already an option to control this. More important, there's no
>>> option to force the rc files to be used, so if -g disables them you'd be
>>> stuck with that.
>>>
>>> I agree that the rc files are a danger when scripting, but if we want to
>>> do something about that then it needs to be consistent for ALL
>>> non-interactive use.
>>>
>>
>> I don't see any problem to load rc files - but should I do it by default?
>> I prefer
>>
>> 1. default - don't read rc
>> 2. possible long option for forcing load rc for -c and -g
>> 3. possible long option for forcing load any file as rc for -c and -g
>>
>>
> ​--psqlrc​
>
> ​; read the standard rc files​
> --no-psqlrc ; do not read the standard rc files
>
> It belongs in a separate patch, though.
>

sure

>
> In this patch -g should disable the reading of the standard rc files.
>

it does

>
> Yet another option could be added that allows the user to point to a
> different set of rc files. Its presence should not cause the
> include/exclude behavior to change. That way you can setup a psql wrapper
> function or alias that uses a different ​rc file while still having control
> over whether it is included or excluded. The problem here is exploding the
> logic in order to deal with both a system and a user rc file.
>

I am not against, but it is not neccessary - you can use -g for reading
some files and later -g for some special action

Regards

Pavel

>
> This would be yet another patch.
>
> My $0.02
>
> David J.
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-08-29 05:27:38 Re: Fwd: Core dump with nested CREATE TEMP TABLE
Previous Message Pavel Stehule 2015-08-29 04:37:09 Re: proposal: multiple psql option -c