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.94.2) (envelope-from ) id 1tP1qI-009lSb-MI for pgsql-interfaces@arkaria.postgresql.org; Sat, 21 Dec 2024 15:56:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tP1qH-009z9e-KT for pgsql-interfaces@arkaria.postgresql.org; Sat, 21 Dec 2024 15:56:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tP1qH-009z9W-D8 for pgsql-interfaces@lists.postgresql.org; Sat, 21 Dec 2024 15:56:37 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tP1qE-000hU5-7i for pgsql-interfaces@postgresql.org; Sat, 21 Dec 2024 15:56:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4BLFuVIq859823; Sat, 21 Dec 2024 10:56:31 -0500 From: Tom Lane To: Jeroen Vermeulen cc: pgsql-interfaces@postgresql.org Subject: Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()? In-reply-to: References: Comments: In-reply-to Jeroen Vermeulen message dated "Sat, 21 Dec 2024 13:54:32 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <859821.1734796591.1@sss.pgh.pa.us> Date: Sat, 21 Dec 2024 10:56:31 -0500 Message-ID: <859822.1734796591@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeroen Vermeulen 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