public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jeroen Vermeulen <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
Date: Sat, 21 Dec 2024 16:59:03 +0100
Message-ID: <CA+zULE5W_AZ6in8y7qfhDwKhhsDOp=O+yAQd0WjqBFY-ELkb7g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+zULE6XGuMU8ND38ABLxgBTN-YFzcnq+MCVb6Tyxgg6ZxYFXw@mail.gmail.com>
	<[email protected]>

Ah, that explains.  Thanks.

On Sat, Dec 21, 2024, 16:56 Tom Lane <[email protected]> wrote:

> Jeroen Vermeulen <[email protected]> writes:
> > Any objections to changing these two libpq functions' PGresult*
> parameters
> > to be const?
>
> > So "char * PQcmdStatus(PGresult *)" would become "char *PQcmdStatus(const
> > PGresult *)", and "char *PQcmdTuples(PGresult *)" would become "char
> > *PQcmdTuples(const PGresult *)".
>
> Both of those return pointers to res->cmdStatus, so it would not make
> any sense to const-ify the argument unless you also const-ify the
> result; which would cause compiler warnings for users.  I'm pretty
> sure we've explicitly rejected making this change for that reason.
>
>                         regards, tom lane
>


view thread (4+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
  In-Reply-To: <CA+zULE5W_AZ6in8y7qfhDwKhhsDOp=O+yAQd0WjqBFY-ELkb7g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox