proposal: multiple psql option -c

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: multiple psql option -c
Date: 2015-07-16 19:42:14
Message-ID: CAFj8pRC9rgn8rcdsTFSoym+ZWePDLtYu_3HvuxbcOUG5vs1Vog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

can we support multiple "-c" option?

Why? Because some statements like VACUUM cannot be used together with any
other statements with single -c option. The current solution is using echo
and pipe op, but it is a complication in some complex scripts - higher
complication when you run psql via multiple sudo statement.

Example:

psql -c "select pg_stat_reset()" -c "vacuum full analyze" dbname

or on all db

psql -At -c "select datname from pg_databases" postgres | \
xargs -n 1 -P 3 psql -c "..." -c "..."

Ideas, notes, comments?

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2015-07-16 20:07:35 Re: proposal: multiple psql option -c
Previous Message Pavel Stehule 2015-07-16 18:00:23 Re: [PATCH] Generalized JSON output functions