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

Поиск
Список
Период
Сортировка
Искать
От
Pavel Stehule
Тема
VIP: new format for psql - shell - simple using psql in shell
Дата
в 12:40:19
Msg-id
CAFj8pRCO4SxxcWXSWxJMdK4eriA6yu2VC2f1syMJnxtK2v23Aw@mail.gmail.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 Bruce Momjian <bruce@momjian.us>
Re: VIP: new format for psql - shell - simple using psql in shell Tom Lane <tgl@sss.pgh.pa.us>
Re: VIP: new format for psql - shell - simple using psql in shell Bruce Momjian <bruce@momjian.us>
Re: 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 Jim Nasby <jim@nasby.net>
Re: 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 Abel Abraham Camarillo Ojeda <acamari@verlet.org>
Re: 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>
Re: VIP: new format for psql - shell - simple using psql in shell Jan-Benedict Glaw <jbglaw@lug-owl.de>
Re: 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 hubert depesz lubaczewski <depesz@depesz.com>
Re: VIP: new format for psql - shell - simple using psql in shell Pavel Stehule <pavel.stehule@gmail.com>
Hello

I proposed new psql's format "shell". This format is optimized for
processing returned result in shell:


postgres=# select * from foo;
      a       | b  |     c
--------------+----+------------
 Hello, World | 10 | 2012-05-26
 Ahoj, Svete  | 20 | 2012-06-15
(2 rows)

postgres=# \pset format shell
Output format is shell.
postgres=# select * from foo;
a b c
Hello,\ World 10 2012-05-26
Ahoj,\ Svete 20 2012-06-15

postgres=# \x
Expanded display is on.
postgres=# select * from foo;
( c l )
( [a]=Hello,\ World [b]=10 [c]=2012-05-26 )
( [a]=Ahoj,\ Svete [b]=20 [c]=2012-06-15 )

shell scripts can looks like:

( psql -t -P format=shell postgres < ${row[$field]}"
      done;
      echo;
    done;)

I invite any comments, mainly from bash or shell experts

Regards

Pavel Stehule
В списке pgsql-hackers по дате отправления
От: Greg Sabino Mullane
Дата:
От: Euler Taveira
Дата:
FAQ