Re: proposal: multiple psql option -c

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: proposal: multiple psql option -c
Дата
Msg-id CAMsr+YFATdPL7bpCyysGFgyzMZ0J_LYoxP+Xjd3tEdvHxcRKLQ@mail.gmail.com
обсуждение исходный текст
Ответ на proposal: multiple psql option -c  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On 17 July 2015 at 03:42, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> 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

I don't see the point. Taking your 'sudo' issue into account, just:

sudo -u postgres psql <'__END__'
select pg_stat_reset();
vacuum full analyze;
__END__


or

echo -e 'select pg_stat_reset()\n vacuum full analyze;' | sudo -u postgres psql

or, of course, just run two commands.

There are plenty of existing ways to do this. Personally I find -c
awkward due to the need to worry about shell quoting and tend to
prefer a quoted here-document lots of the time anyway.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: multiple psql option -c
Следующее
От: Kouhei Kaigai
Дата:
Сообщение: Re: [DESIGN] ParallelAppend