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.96) (envelope-from ) id 1vg3Hx-007c7I-19 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jan 2026 16:00:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vg3Hw-00BLaw-1c for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jan 2026 16:00:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vg3Hv-00BLao-2X for pgsql-hackers@lists.postgresql.org; Wed, 14 Jan 2026 16:00:04 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vg3Ht-000SBz-0f for pgsql-hackers@lists.postgresql.org; Wed, 14 Jan 2026 16:00:03 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 967191D00159; Wed, 14 Jan 2026 10:59:58 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 14 Jan 2026 10:59:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1768406398; x=1768492798; bh=i/P6vqxSuq/1mJvbt91KYHZ2AcOlstcci10aJA82jmM=; b= i77OsnxrSCssidVyD1LFdyjCteWlArvYccap0r9q4d7dJhUkQB5ig+YLfs6LrXKW uppPsuAaebwWcoobyYvL4DUcFw05mmdNN0FEUOwziqx2QLJf4FeamnVJ1kwUwsIV fAGCT6YqXcwpVKKzLOGD8MvViavLmxj37jQrgVBW3WAT/sFW1PE3B4E0HHxhn60k UPedAAlmuCDcWmExAIgXGmHc7KsxXpHhA+QJkqYdnzVqj7vfJCUPxt5VKV7bNF5/ Y9B01agpHQ6DkGdhUcJbka+7aj/Feyqz2toTzpALUpZhngacM78WEKhCKJPq9MZP y/69GFF4ZqvlVJRaoOpRMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768406398; x=1768492798; bh=i /P6vqxSuq/1mJvbt91KYHZ2AcOlstcci10aJA82jmM=; b=N83C7o1Otyh5pZ3Gl aTdWb+TgsM0hnJKG4N9eGY+jRSrB0YyzirzzkO2RawDO7x2MPo/B2PANd0cOCtci Bfk1PvTIOzMSI+4j/1/nCXI5zRx5DNfJC2V56S9LCWezsX7SLlV87LM/PzFpn1C+ jDPWEhKqB8igRnAtCz+mbJgyFIBiDzsS+KorgRRIxvhDM1BELiXT6kYnQutMnwCY yySrCRarB64HZIORaDLfv5fA18lKr9jBo5M3F5PlIpJ1LA3wHKAMhbMVxLjtLmbd rMElo3Ubo9jxQOia2gYuos3CJLX3hoHQnxG3hu0AcgiorAq9jo4ITCFTPnsvleXK Cf8PQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdefiedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomheprfgvthgvrhcu gfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeehiedvhfeuhfeugefgfeehgeejtdevuefhtefhueefvddugfdt ueehgfefudfhffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdpnhgspghrtghpthhtohep fedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhoshhtghhrvghssehjvghlth gvfhdrnhhlpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphho shhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepthhhohhmrghsrdhmuhhnrhhosehgmh grihhlrdgtohhm X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Jan 2026 10:59:57 -0500 (EST) Message-ID: Date: Wed, 14 Jan 2026 16:59:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Make copyObject work in C++ To: Jelte Fennema-Nio , PostgreSQL Hackers , Thomas Munro References: <4d8b9e53-3f37-43f0-a4aa-5bda9c7961b3@eisentraut.org> Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10.01.26 12:09, Jelte Fennema-Nio wrote: > On Sat Jan 3, 2026 at 10:32 AM CET, Jelte Fennema-Nio wrote: >> Attached is a patchset that does that. It required a few more fixes to >> make the extension compile on MSVC too. > > Rebased after Peter merged the C++ improvements from the other thread. I have a couple of comments on the sample extension module. I think this module should have a runtime test, too. Otherwise you don't know that you got the linkage correct, or whether this works at all. It doesn't have to do much, like it could literally be a + b, and it could evolve in the future to test hooks, _PG_init, etc. Let's put a README file in the module's directory instead of putting the explanation into the Makefile/meson.build. I wonder if the module's build integration would work correctly in the autoconf/makefile case if no C++ is available. AFAICT, it would fail to build with g++ not found or similar. AFAICT, the minimum changes to get a minimum test module to work are - fix for "restrict", recently committed - disable warning about zero-length arrays, seems trivial - named designated initializers I learned that named designated initializers in C++ are not allowed to be specified out of order, so they are not a full equivalent to the C syntax. This could be a problem for example if someone wanted in the future to have something like PG_MODULE_MAGIC_EXT(.threads_supported = true) (while not specifying the leading .name and .version fields). I think for now the easiest fix would be to just not use the named initializers in the definition of PG_MODULE_MAGIC_DATA. Then we don't need to require C++20 and have that additional code. In the future, we might need a different solution more suitable for C++. The use of -std=c++11 for CI is a valid idea; I have often wanted that for C as well. But conversely we also want to allow testing optional extension and future C standard features. So we need a comprehensive solution there that covers both ends and both languages. Let's leave that out for now and think about it separately.