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 1sni8W-005XcT-SI for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Sep 2024 17:25:13 +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 1sni8W-00Fx14-5k for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Sep 2024 17:25:12 +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 1sni8V-00Fwzw-Ro for pgsql-hackers@lists.postgresql.org; Mon, 09 Sep 2024 17:25:11 +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 1sni8O-000KoT-TB for pgsql-hackers@postgresql.org; Mon, 09 Sep 2024 17:25:10 +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 489HP2wi3213438; Mon, 9 Sep 2024 13:25:02 -0400 From: Tom Lane To: Robert Haas cc: Ed Behn , pgsql-hackers@postgresql.org Subject: Re: access numeric data in module In-reply-to: References: <3142462.1725891243@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 09 Sep 2024 13:00:59 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3213436.1725902702.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 09 Sep 2024 13:25:02 -0400 Message-ID: <3213437.1725902702@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Mon, Sep 9, 2024 at 10:14 AM Tom Lane wrote: >> It's intentional that that stuff is not exposed, so no. >> What actual functionality do you need that numeric.h doesn't expose? > I don't agree with this reponse at all. It seems entirely reasonable > for third-party code to want to have a way to construct and interpret > numeric datums. Keeping the details private would MAYBE make sense if > the internal details were changing release to release, but that's > clearly not the case. We have changed numeric's internal representation in the past, and I'd like to keep the freedom to do so again. There's been discussion for example of reconsidering the choice of NBASE to make more sense on 64-bit hardware. Yeah, maintaining on-disk compatibility limits what we can do there, but not as much as if some external module is in bed with the representation. > Even if it were, an extension author is > completely entitled to say "hey, I'd rather have access to an unstable > API and update my code for new releases" and we should accommodate > that. If we don't, people don't give up on writing the code that they > want to write -- they just cut-and-paste private declarations/code > into their own source tree, which is WAY worse than if we just put the > stuff in a .h file. IMO it'd be a lot better if numeric.c exposed whatever functionality Ed feels is missing, while keeping the contents of a numeric opaque. regards, tom lane