From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix -Wcast-qual warnings in psql
Date: Wed, 25 Nov 2026 08:07:09 +0000
Message-ID: <E1xW821-00000000Ety-1C2r@gemulon.postgresql.org> (raw)
Fix -Wcast-qual warnings in psql
Some platforms declare HIST_ENTRY.line as const char * (apparently
macOS and NetBSD libedit), but we cast that away using (char *) and
write into it. To appease -Wcast-qual, change that cast to
unconstify(). But for other platforms where it is plain char * to
begin with, unconstify doesn't work because it doesn't allow casting a
non-const to a non-const. So to make this work portably we first have
to cast to (const char *). (Maybe we could make unconstify handle
this, but so far it is only required in this one place, so it might
not be worth it.)
Reported-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/70b86618-4038-4b19-8847-1a400d99d477%40eisentraut.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5ff67951c46d304d5ac4cda62eb99d64cd292c8c
Modified Files
--------------
src/bin/psql/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Fix -Wcast-qual warnings in psql
In-Reply-To: <E1xW821-00000000Ety-1C2r@gemulon.postgresql.org>
References: <E1xW821-00000000Ety-1C2r@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox