Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?

From: Jeroen Vermeulen <jtvjtv(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
Date: 2024-12-21 15:59:03
Message-ID: CA+zULE5W_AZ6in8y7qfhDwKhhsDOp=O+yAQd0WjqBFY-ELkb7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Ah, that explains. Thanks.

On Sat, Dec 21, 2024, 16:56 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Jeroen Vermeulen <jtvjtv(at)gmail(dot)com> 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
>

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2024-12-21 16:06:58 Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
Previous Message Tom Lane 2024-12-21 15:56:31 Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?