-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL errors are discarded when using the pspg pager #1200
Comments
With the following patch: diff --git a/pgcli/main.py b/pgcli/main.py
index b146898..1f4c947 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -903,6 +903,9 @@ def _evaluate_command(self, text):
logger.debug("rows: %r", cur)
logger.debug("status: %r", status)
+ if not success and self.table_format == 'csv':
+ self.echo_via_pager(status)
+
if self._should_limit_output(sql, cur):
cur, status = self._limit_output(cur) the error above comes out as follows:
Is this reasonable? |
Apparently nobody is using pspg... 🤔 |
Hah. Apparently so! |
I agree, but I could not figure out a non invasive alternative 🤷♂️ |
Looking at Line 947 in baea769
so do things break/not handled in Line 410 in baea769
|
No, |
@lelit Would you like to attempt fixing that? |
In some other way than the simplistic way above you mean? |
Yes. So we can have output consistent with non-pspg pagers. |
#1230 is related to this issue too. Unfortunately, CSV is too simple format, and it is impossible clean garbage in format on reader side. |
I've just hit this issue, plus there is a missing output from e.g. @delete from@ - no info on how many records were removed when output is set to csv |
note: pgcli fixed issue with slow print in table format. So workaround with csv format is not necessary now. |
@okbob I'm not sure to understand what you mean: are you saying that I can leave |
pá 28. 5. 2021 v 17:40 odesílatel Lele Gaifax ***@***.***>
napsal:
@okbob <https://github.com/okbob> I'm not sure to understand what you
mean: are you saying that I can leave table_format to the default and
remove --csv option from the pgpg pager, or what?
yes
—
… You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEFO45Q6NB44GC4FQPKFWLTP62QHANCNFSM4PP3VZLA>
.
|
Thanks, I will try and report back. Maybe you could rectify the suggested configuration here? |
yes, I'll fix it |
@lelit Was your problem fixed? |
I haven't tried okbob's solution yet, so I'm still using my hacked fork. I'll do my best to try the easy way and report back soon. |
Yes, I confirm that what @okbob suggested fixes this issue! To be clear, now my
and everything seems working as expected 🎉. As a side note for @okbob: after looking up the meaning for the Thanks a lot! |
so 12. 6. 2021 v 11:56 odesílatel Lele Gaifax ***@***.***>
napsal:
Yes, I confirm that what @okbob <https://github.com/okbob> suggested
fixes this issue!
To be clear, now my pgclirc contains
pager = pspg --rr=2 --quit-if-one-screen --ignore-case -s 4 -X
table_format = psql
and everything seems working as expected 🎉.
As a side note for @okbob <https://github.com/okbob>: after looking up
the meaning for the --pgcli-fix option you suggest in the pgcli section,
it seems redundant without --csv.
I modified pspg readme
Thank you for check
Pavel
… Thanks a lot!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEFO4YR246K2XNDZRE4IU3TSMVK7ANCNFSM4PP3VZLA>
.
|
Description
I use the following settings in my
pgclirc
file:and I'm quite happy, except for one notable defect: when I execute a query containing an error, pgcli does not properly handle the case and still emit the output coming from PG thru the pager, that simply discards it not being a
CSV
stream.For example, not using the pager I get:
while going thru
pspg
this is what I get:Maybe the _evaluate_command() function should return that
success
flag to the caller and the latter emit the output without the pager?Environment
The same happens with latest released version of
pspg
, 3.1.2.The text was updated successfully, but these errors were encountered: