Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOn8X-0006Fe-Px for pgsql-hackers@arkaria.postgresql.org; Thu, 09 May 2019 17:47:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hOn8W-0001JT-DJ for pgsql-hackers@arkaria.postgresql.org; Thu, 09 May 2019 17:47:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOn8W-0001JL-1K for pgsql-hackers@lists.postgresql.org; Thu, 09 May 2019 17:47:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOn8T-0008Au-NH for pgsql-hackers@postgresql.org; Thu, 09 May 2019 17:47:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x49HlC1q027316; Thu, 9 May 2019 13:47:12 -0400 From: Tom Lane To: Alvaro Herrera cc: Peter Eisentraut , Ian Barwick , "pgsql-hackers@postgresql.org" Subject: Re: PG12, PGXS and linking pgfeutils In-reply-to: <20190509173911.GA16616@alvherre.pgsql> References: <20190509173911.GA16616@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 09 May 2019 13:39:11 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27314.1557424032.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 09 May 2019 13:47:12 -0400 Message-ID: <27315.1557424032@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2019-May-09, Tom Lane wrote: >> I'm not especially on board with the idea of moving FE-specific error >> handling code into libpgcommon, as that breaks the concept that >> src/common/ is broadly for code that can work in either frontend or >> backend contexts. However, we already have a few violations of that >> rule: common/Makefile already has >> = >> # A few files are currently only built for frontend, not server >> OBJS_FRONTEND =3D $(OBJS_COMMON) fe_memutils.o file_utils.o restricted_= token.o >> = >> So maybe the answer is to move these logging support functions into >> src/common, in a file that's only built for frontend. > I wonder if a better solution isn't to move the file_utils stuff to > fe_utils. Half of it is frontend-specific. The only one that should be > shared to backend seems to be fsync_fname ... but instead of sharing it, > we have a second copy in fd.c. Hm, if file_utils is the only thing in common/ that uses this, and we expect that to remain true, that would fix the issue. But ... The thing I was looking at was mainly fe_memutils, which is justifiably here on the grounds that it provides backend-like palloc support and thereby eases the task of making other common/ modules work in both contexts. If we built elog/ereport emulations on top of Peter's logging functions, there'd be a very clear case for having that in common/. Peter didn't do that for v12, but I hope we get there at some point. regards, tom lane