Re: [GENERAL] Request - repeat value of \pset title during \watch interations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Request - repeat value of \pset title during \watch interations
Date: 2016-03-21 17:14:24
Message-ID: 24397.1458580464@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Well, the title isn't normally centered, but yeah, that is odd. Yeah,
> that is odd. Come to think of it, I think I might have expected the
> title to appear *above* "Watch every %s", not below it. That might
> decrease the oddness.

AFAICS, it appears *beside* it with this patch. It's only below if the
terminal is narrow enough that it wraps to there.

> As for letting the committer decide, I don't care about this
> personally at all, so I'm only looking at it to be nice to the people
> who do. Whatever is the consensus is OK with me. I just don't want
> to get yelled at later for committing something here, so it would be
> nice to see a few votes for whatever we're gonna do here.

I'm still of the opinion that what would make the most sense is to replace
the "Watch every Ns" text with the user-given title, if there is one.
I ran that up the flagpole already and didn't get a lot of salutes, but
it seems to respond to your concern that the user title ought to be first.

Regardless of that, I concur with your complaints about coding style, in
particular with the need to repeat the magic constant 50 in several
places. Also, I think the patch makes do_watch return the wrong result
code for the (typical) case where we exit because of query cancel not
PSQLexecWatch failure.

So on the whole, I'd do it as attached.

regards, tom lane

Attachment Content-Type Size
psql_watch_title-v4.patch text/x-diff 2.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-03-21 17:34:02 Re: [GENERAL] Request - repeat value of \pset title during \watch interations
Previous Message Jernigan, Kevin 2016-03-21 16:46:51 Re: PostgreSQL advocacy

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-03-21 17:34:02 Re: [GENERAL] Request - repeat value of \pset title during \watch interations
Previous Message Petr Jelinek 2016-03-21 17:10:55 Re: Proposal: Generic WAL logical messages