okbob / pspg

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.
BSD 2-Clause "Simplified" License
2.43k stars 85 forks source link

difference in pgcli and psql table behavior in pspg #226

Closed 0-issue closed 1 year ago

0-issue commented 1 year ago

Not sure if this is a pgcli issue or pspg, but the table output from pgcli seems off in pspg... The table and data are same as in https://github.com/okbob/pspg/issues/224#issue-1776226772, run this query after loading the table in pgcli and psql:

select distinct state_name from us_counties_pop_est_2019;

psql output (correct):

Screenshot 2023-06-29 at 3 47 36 PM

pgcli output (not correct, see that SELECT 51):

Screenshot 2023-06-29 at 3 48 02 PM

Same problem is seen with other commands too...

\d us_counties_pop_est_2019;

psql output (correct):

Screenshot 2023-06-29 at 4 17 01 PM

pgcli output (not correct, see the Indexes section picked in the table):

Screenshot 2023-06-29 at 4 16 44 PM
okbob commented 1 year ago

pá 30. 6. 2023 v 1:19 odesílatel amanvm @.***> napsal:

Not sure if this is a pgcli issue or pspg, but the table output from pgcli seems off in pspg... The table and data are same as in #224 (comment) https://github.com/okbob/pspg/issues/224#issue-1776226772, run this query after loading the table in pgcli and psql:

select distinct state_name from us_counties_pop_est_2019;

psql output (correct): [image: Screenshot 2023-06-29 at 3 47 36 PM] https://user-images.githubusercontent.com/25681815/249917879-545d5ce2-5c77-4c64-9b3d-a4b3974e8360.png

pgcli output (not correct, see that SELECT 51): [image: Screenshot 2023-06-29 at 3 48 02 PM] https://user-images.githubusercontent.com/25681815/249917848-c21d3c9c-2b20-4613-8459-a3d09b59e94d.png

Same problem is seen with other commands too...

\d us_counties_pop_est_2019;

psql output (correct): [image: Screenshot 2023-06-29 at 4 17 01 PM] https://user-images.githubusercontent.com/25681815/249924931-79301c35-4a58-4f1c-b54f-3dc9e2417cb2.png

pgcli output (not correct, see the Indexes section picked in the table): [image: Screenshot 2023-06-29 at 4 16 44 PM] https://user-images.githubusercontent.com/25681815/249924904-cad12aeb-d540-488d-a573-eadb27477532.png

It is an issue on pgcli, I think. Probably you use CSV output. Unfortunately, pgcli adds info about the number of lines in to output. You can try option --pgcli-fix or --ignore-bad-rows

Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO42SMVSSLXEPSIM2JCDXNYERNANCNFSM6AAAAAAZZEDBMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

okbob commented 1 year ago

pá 30. 6. 2023 v 5:36 odesílatel Pavel Stehule @.***> napsal:

pá 30. 6. 2023 v 1:19 odesílatel amanvm @.***> napsal:

It is an issue on pgcli, I think. Probably you use CSV output. Unfortunately, pgcli adds info about the number of lines in to output. You can try option --pgcli-fix

or you can use some other classic format in pgcli. Originally, csv format was preferred in pgcli, because other formats were terribly slow. But this issue should be fixed already.

Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO42SMVSSLXEPSIM2JCDXNYERNANCNFSM6AAAAAAZZEDBMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

okbob commented 1 year ago

I tested pgcli, and it is pgcli issue. It produces "partially" broken CSV, because prints info as part of CSV output. You should to use --ignore-short-rows option (of pspg) to fix it.

0-issue commented 1 year ago

@okbob Thanks, adding that option to pgcli's config for pspg pager resolves the problem.