Re: Adding comments to help understand psql hidden queries

From: David Christensen <david+pg(at)pgguru(dot)net>
To: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding comments to help understand psql hidden queries
Date: 2024-04-03 17:16:05
Message-ID: CAHM0NXi5G9RwtH_MRQkh2jcZMvn8Uubm9pMn=KW-AuwYcNk51w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I got Greg's blessing on squashing the commits down, and now including
a v4 with additional improvements on the output formatting front.
Main changes:

- all generated comments are the same width
- width has been bumped to 80
- removed _() functions for consumers of the new output functions

This patch adds two new helper functions, OutputComment() and
OutputCommentStars() to output and wrap the comments to the
appropriate widths. Everything should continue to work just fine if
we want to adjust the width by just adjusting the MAX_COMMENT_WIDTH
symbol.

I removed _() in the output of the query/stars since there'd be no
sensible existing translations for the constructed string, which
included the query string itself. If we need it for the "QUERY"
string, this could be added fairly easily, but the existing piece
would have been nonsensical and never used in practice.

Thanks,

David

Attachment Content-Type Size
v4-0001-Improve-SQL-comments-on-echo-hidden-output.patch application/octet-stream 21.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-04-03 17:17:31 Re: Use streaming read API in ANALYZE
Previous Message Melanie Plageman 2024-04-03 17:04:07 Re: Combine Prune and Freeze records emitted by vacuum