Hi!

I have sent a patch to pgsql-patches:
  http://archives.postgresql.org/pgsql-patches/2008-04/msg00050.php
...which adds \G command to psql client.

The idea of \G command is to perform the query, but with printing
query results using extended table output format.

For example:

postgres=# SELECT * FROM pg_stat_activity;
 datid | datname  | procpid | usesysid | usename  |
current_query          | waiting |          xact_start           |
     query_start          |         backend_start         |
client_addr | client_port
-------+----------+---------+----------+----------+---------------------------------+---------+-------------------------------+-------------------------------+-------------------------------+-------------+-------------
 11511 | postgres |   11729 |       10 | postgres | SELECT * FROM
pg_stat_activity; | f       | 2008-04-03 14:40:15.277272+02 |
2008-04-03 14:40:15.277272+02 | 2008-04-03 14:39:50.050512+02 |
     |          -1
(1 row)

postgres=# SELECT * FROM pg_stat_activity\G
-[ RECORD 1 ]-+-------------------------------
datid         | 11511
datname       | postgres
procpid       | 11729
usesysid      | 10
usename       | postgres
current_query | SELECT * FROM pg_stat_activity
waiting       | f
xact_start    | 2008-04-03 14:41:47.533763+02
query_start   | 2008-04-03 14:41:47.533763+02
backend_start | 2008-04-03 14:39:50.050512+02
client_addr   |
client_port   | -1

postgres=# SELECT * FROM pg_stat_activity\g
 datid | datname  | procpid | usesysid | usename  |
current_query          | waiting |          xact_start           |
     query_start          |         backend_start         |
client_addr | client_port
-------+----------+---------+----------+----------+--------------------------------+---------+-------------------------------+-------------------------------+-------------------------------+-------------+-------------
 11511 | postgres |   11729 |       10 | postgres | SELECT * FROM
pg_stat_activity | f       | 2008-04-03 14:42:09.940897+02 |
2008-04-03 14:42:09.940897+02 | 2008-04-03 14:39:50.050512+02 |
     |          -1
(1 row)

Comments anyone?

   Regards,
       Dawid

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to