Re: proposal: multiple psql option -c - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal: multiple psql option -c
Date
Msg-id CAFj8pRD2jGa7EPuVmdx_8pEbd2RG-p_fAzkfr-X1qahJLWOQnw@mail.gmail.com
Whole thread Raw
In response to Re: proposal: multiple psql option -c  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: proposal: multiple psql option -c
Re: proposal: multiple psql option -c
List pgsql-hackers


2015-07-27 20:47 GMT+02:00 Robert Haas <robertmhaas@gmail.com>:
On Mon, Jul 27, 2015 at 2:37 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> 2015-07-27 20:32 GMT+02:00 Robert Haas <robertmhaas@gmail.com>:
>>
>> On Sat, Jul 25, 2015 at 5:27 AM, Pavel Stehule <pavel.stehule@gmail.com>
>> wrote:
>> > It will be nice side effect, but my primary problem was a impossibility
>> > to
>> > combine VACUUM and any other statement to one simple psql call.
>>
>> Seems like you can do that easily enough:
>>
>> [rhaas pgsql]$ (echo 'SELECT 1;'; echo 'VACUUM;'; echo 'SELECT 2;') | psql
>>  ?column?
>> ----------
>>         1
>> (1 row)
>>
>> VACUUM
>>  ?column?
>> ----------
>>         2
>> (1 row)
>>
>
> how I can do it with xargs?

I don't specifically what you're trying to do, but I bet it's not that hard.

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()"

Pavel
 

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

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: anole: assorted stability problems
Next
From: Heikki Linnakangas
Date:
Subject: Re: spgist recovery assertion failure