Re: Record Separator with psql -c when output to a variable not a file!

Поиск
Список
Период
Сортировка
От Vick Khera
Тема Re: Record Separator with psql -c when output to a variable not a file!
Дата
Msg-id AANLkTikj0sDPEtzV_jOY9wKxvB=RRc7ok3+S+Jx4S6r5@mail.gmail.com
обсуждение исходный текст
Ответ на Record Separator with psql -c when output to a variable not a file!  (andrew harvey <a.andrewharvey@gmail.com>)
Список pgsql-general
On Mon, Oct 4, 2010 at 3:51 PM, andrew harvey <a.andrewharvey@gmail.com> wrote:
> command="`psql  -c "SELECT * FROM pg_stat_database`"
>
> when you retain the query result within the variable $command you need
> to count all the fields in the entire output in order to select the
> particular one that you want. (because the record separator newline
> doesn't apply to within the variable named above) Therefore all the
> sql output is bundled up into one string with very, very many fields.
>

To be clear, the backtick expression in the shell is what is eating
the newlines and converting them to spaces.  That's part of the
definition of how the backticks work.

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

Предыдущее
От: Miklosi Attila
Дата:
Сообщение: error messages
Следующее
От: Vick Khera
Дата:
Сообщение: Re: [Off Topic] Software load balancing question