Re: proposal: multiple psql option -c

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(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-07-28 16:46:38
Message-ID: 55B7B1EE.2090002@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 07/28/2015 11:52 AM, Pavel Stehule wrote:
>
>
> 2015-07-28 15:16 GMT+02:00 Andrew Dunstan <andrew(at)dunslane(dot)net
> <mailto:andrew(at)dunslane(dot)net>>:
>
>
> On 07/28/2015 12:08 AM, Pavel Stehule wrote:
>
>
>
> 2015-07-28 5:24 GMT+02:00 Pavel Stehule
> <pavel(dot)stehule(at)gmail(dot)com <mailto:pavel(dot)stehule(at)gmail(dot)com>
> <mailto:pavel(dot)stehule(at)gmail(dot)com
> <mailto:pavel(dot)stehule(at)gmail(dot)com>>>:
>
>
>
> 2015-07-27 21:57 GMT+02:00 Andrew Dunstan
> <andrew(at)dunslane(dot)net <mailto:andrew(at)dunslane(dot)net>
> <mailto:andrew(at)dunslane(dot)net <mailto:andrew(at)dunslane(dot)net>>>:
>
>
> On 07/27/2015 02:53 PM, Pavel Stehule wrote:
>
>
>
>
>
> I am trying to run parallel execution
>
> psql -At -c "select datname from pg_database"
> postgres |
> xargs -n 1 -P 3 psql -c "select current_database()"
>
>
>
>
> I don't think it's going to be a hugely important
> feature, but
> I don't see a problem with creating a new option (-C seems
> fine) which would have the same effect as if the arguments
> were contatenated into a file which is then used with
> -f. IIRC
> -c has some special characteristics which means it's
> probably
> best not to try to extend it for this feature.
>
>
> ok, I'll try to write patch.
>
>
> I have a question. Can be -C option multiple?
>
> The SQL is without problem, but what about \x command?
>
> postgres=# \dt \dn select 10;
> No relations found.
> List of schemas
> ┌──────┬───────┐
> │ Name │ Owner │
> ╞══════╪═══════╡
> └──────┴───────┘
> (0 rows)
>
> \dn: extra argument "10;" ignored
>
>
>
> I don't understand the question.
>
> You should include one sql or psql command per -C option, ISTM. e.g.
>
> psql -C '\dt' -C '\dn' -C 'select 10;'
>
>
> Isn't that what we're talking about with this whole proposal?
>
>
>
> I am searching some agreement, how to solve a current "-c" limits. I
> am 100% for >>> psql -C '\dt' -C '\dn' -C 'select 10;' <<<
>
>

I think you're probably best off leaving -c alone. If there are issues
to be solved for -c they should be handled separately from the feature
we agree on.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-07-28 16:59:02 Re: Re: Removing SSL renegotiation (Was: Should we back-patch SSL renegotiation fixes?)
Previous Message Tom Lane 2015-07-28 16:18:53 Re: Sharing aggregate states between different aggregate functions