Re: VIP: new format for psql - shell - simple using psql in shell

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: VIP: new format for psql - shell - simple using psql in shell
Дата
Msg-id 20120527121520.GA2199@depesz.com
обсуждение исходный текст
Ответ на VIP: new format for psql - shell - simple using psql in shell  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: VIP: new format for psql - shell - simple using psql in shell  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Sat, May 26, 2012 at 05:39:23PM +0200, Pavel Stehule wrote:
> I proposed new psql's format "shell". This format is optimized for
> processing returned result in shell:

While I generally like the idea, please note that safe reading output
from queries is possible, with COPY, and proper IFS, like:

=$ psql -c "select * from t"a  |  b  |     c     
----+-----+-----------a1 | b 2 | c|3a +| b  +| c:|     64  | 5  +|    |     | 
(2 rows)


=$ psql -qAtX -c "copy (select * from t) to stdout" | while IFS=$'\t' read -r a b c; do echo -e "a=[$a] b=[$b] c=[$c]";
done
a=[a1] b=[b 2] c=[c|3]
a=[a
4] b=[b
5
] c=[c:|        6]

that being said - I would love to get more functional psql.

Best regards,

depesz

-- 
The best thing about modern society is how easy it is to avoid contact with it.
                  http://depesz.com/
 


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_upgrade libraries check
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pg_upgrade libraries check