Closed velle closed 1 year ago
Hi
čt 13. 7. 2023 v 11:56 odesílatel velle @.***> napsal:
Consider the following command:
$ psql -c "SELECT * FROM foo" gid | id | geom -----+----+---------------------------------------------------------------------------------------------------------------------------------------------------- 1 | 1 | 01020000000400000000000000000024400000000000000000000000000000244000000000000049400000000000003440000000000000494000000000000034400000000000000000 2 | 2 | 0102000000040000000000000000003E4000000000000000000000000000003E4000000000008051400000000000004940000000000080514000000000000049400000000000000000 (2 rows)
I can use pspg in two ways
- $ psql -c "SELECT * FROM cubetown.LS_c" | pspg
- $ PAGER=pspg psql -c "SELECT * FROM cubetown.LS_c"
Are they equivalent?
yes, for pspg's perspective they are same
pspg can read csv too. So you can do
psql -c "SELECT .." --csv | pspg --csv
In both cases, does pgsg simply receive the output as a ascii-formatted table (using vertical pipe symbol, spaces and newlines)? Or does pspg receive the data in another format? Does the data received by pgps contain data (in addition to what I can see when printed directly to terminal), eg metadata such as datatype for each column that could hint how to format the data in the most user-friendly way?
The default format is just plain text - psql returns only a formatted table (in plain text) without metadata or any invisible data.
I am asking about this in order to figure out, if I can customize pspg to do what I am trying to achieve :)
pspg can work as a postgres client directly when pspg was compiled with libpq support.
pspg -d postgres -h localhost -q "select * from ..."
Sincerely
— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/230, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO43VEL5QVCTBGNWAHH3XP7A4VANCNFSM6AAAAAA2IWBTHI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
The best input format (for pspg) is output of psql with settings
\pset linestyle unicode
\pset border 2
\pset null ∅
Consider the following command:
I can use pspg in two ways
$ psql -c "SELECT * FROM cubetown.LS_c" | pspg
$ PAGER=pspg psql -c "SELECT * FROM cubetown.LS_c"
Are they equivalent?
In both cases, does pgsg simply receive the output as a ascii-formatted table (using vertical pipe symbol, spaces and newlines)? Or does pspg receive the data in another format? Does the data received by pgps contain data (in addition to what I can see when printed directly to terminal), eg metadata such as datatype for each column that could hint how to format the data in the most user-friendly way?
I am asking about this in order to figure out, if I can customize pspg to do what I am trying to achieve :)
Sincerely