Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wGDya-0060ew-1y for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Apr 2026 10:41:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wGDyZ-005wku-25 for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Apr 2026 10:41:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wGDyZ-005wkl-0y for pgsql-hackers@lists.postgresql.org; Fri, 24 Apr 2026 10:41:35 +0000 Received: from udcm-wwu2.uni-muenster.de ([128.176.118.28]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wGDyW-00000002oNh-45B8 for pgsql-hackers@lists.postgresql.org; Fri, 24 Apr 2026 10:41:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uni-muenster.de; i=@uni-muenster.de; q=dns/txt; s=uniout; t=1777027293; x=1808563293; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=brGYEXfuIUB/ayP5v2raF7+olre4BWDybB+WNx+SVvo=; b=NN3Q7N/3kY6VZ9lh84lifAQ5Q0IA7sGclSGmmQRNjzWoi5eVwyqikmYM vI5Q0t9jIKITkoM7eIZ7sqHq5Nk3O4lUHpxnh/zjiPsaGM3AYOJFKvnTY bWxh90BLMR0Ru8OaE9Cced3zoOgzM+o8VGf5rEiGJ5D5gyG8adPv8cgML B2tjRj80meIBP23aDCpGZG272YMb2X+HUFXdaCuo+oRmdGBHnp9E68J6W o+Htl30PjB16qjxxvFdD1auPzhfgp+TaZ73NHCJBzLTa5UZwNmHq5Q1lx BoOpShFxH/C1cFWBoZzHoHLWP+hCTSITrZNyVEW/Ap+Y4VodakZGOwCcl A==; X-CSE-ConnectionGUID: AYbt2XS5Q9WLwSqkbSIc2A== X-CSE-MsgGUID: Ja+La+meTnaftIiEFQR3HA== X-IronPort-AV: E=Sophos;i="6.23,196,1770591600"; d="scan'208";a="391984582" Received: from secmail.uni-muenster.de ([128.176.118.4]) by UDCM-RELAY2.UNI-MUENSTER.DE with ESMTP; 24 Apr 2026 12:41:32 +0200 Received: from [192.168.178.40] (dynamic-093-133-025-176.93.133.pool.telefonica.de [93.133.25.176]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id 9E80220ADF00; Fri, 24 Apr 2026 12:41:31 +0200 (CEST) Message-ID: <4b96eb7c-1390-4fb8-82b5-da27a62b9a1f@uni-muenster.de> Date: Fri, 24 Apr 2026 12:41:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: PoC - psql - emphases line with table name in verbose output To: Pavel Stehule Cc: PostgreSQL Hackers References: Content-Language: de-DE, en-GB From: Jim Jones In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 24/04/2026 08:56, Pavel Stehule wrote: > Please, can you check the functionality (only in english). I am > interested if this is just helpful and if it makes sense to continue in > this feature. Unfortunately, there are not too many possibilities about > possible formats, colors in terminals (that can work mostly everywhere).  I tested it yesterday with lc_messages = 'en_GB.UTF-8' and it worked just fine. And I also agree that it is currently hard to spot tables in the verbose output. > I don't think it is possible to implement this without  communication > protocol enhancement. And if we will do this, the next question is if we > cannot use this for some more complex information about the executed > command. > > For example - I thought about the possibility of teaching psql to read > progress stat tables - so can be nice, if the server can send some > information to client - maybe pgstat_progres_update can send INFO  > > like - "emphasize: nextinfo, pid: xxxx, progress table: pg_stat_vacuum, > commandtype: vacuum, .... > > Maybe a different approach - instead of a plain text message, we can > send messages of this type in client side parsable format - if I am not > wrong, we are able to parse json on client side. json is still readable > for humans for old clients. On the client side we decide what and how we > will display. This can be more generic than just for VERBOSE mode of > ANALYZE, VACUUM or REINDEX. > > some like > > elog(INFO_CLIENT, '{ "cmdtag": "VACUUM", "state":"started", > "progress_tab": "pg_stat_progress_vacuum", "table_name": "yyy", > "schema_name":"xxx", ...) > > elog(INFO_CLIENT, '{"cmdatag": "VACUUM", "state":"finished", > "pages_removed": 0, "pages_ ... I think it is feasible. The question is now is rather, is it worth the trouble just to highlight an output? I also don't see an easy way to implement this feature. It's virtually impossible to do that without some change in the server side. I took a look at the code and perhaps NoticeProcessor() at common.c would be better than pg_log_generic_v() for that, but still the problem of identifying the INFO messages remains. One option would be to create a new SQLSTATE and add it to the ereport calls, e.g. ERRCODE_VERBOSE_PROGRESS_INFO if (verbose) { if (vacrel->aggressive) ereport(INFO, errcode(ERRCODE_VERBOSE_PROGRESS_INFO), (errmsg("aggressively vacuuming \"%s.%s.%s\"", vacrel->dbname, vacrel->relnamespace, vacrel->relname))); else ereport(INFO, errcode(ERRCODE_VERBOSE_PROGRESS_INFO), (errmsg("vacuuming \"%s.%s.%s\"", vacrel->dbname, vacrel->relnamespace, vacrel->relname))); } Then in NoticeProcessor() check for it and act accordingly: const char *state = PQresultErrorField(result, PG_DIAG_SQLSTATE); if (state && strcmp(state, "00001") == 0) ... apply color / blank line / bold / whatever But it also looks like we'd be using SQLSTATES incorrectly. That would certainly require a bit more research. > I don't see some simple and nice solution at this moment. Maybe just > using new line after INFO with details It's much less invasive with more or less the same effect. However, the Error Message Style Guide explicitly says "Don't put any specific assumptions about formatting into the message texts" and "Don't end a message with a newline"[1]. So I'm afraid it's not an option either :\ Of course, it could also disturb external tools that parse the verbose output, but that alone wouldn't be a blocker IMHO. Thanks! Best, Jim 1 - https://www.postgresql.org/docs/current/error-style-guide.html#ERROR-STYLE-GUIDE-FORMATTING