Re: Make copyObject work in C++

From: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
To: "Andres Freund" <andres(at)anarazel(dot)de>
Cc: "Peter Eisentraut" <peter(at)eisentraut(dot)org>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Thomas Munro" <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Make copyObject work in C++
Date: 2026-02-13 10:28:20
Message-ID: DGDRHFD14I7Z.30DSV2XVI6V93@jeltef.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun Jan 25, 2026 at 9:06 PM CET, Andres Freund wrote:
> Named args make that easier in two ways: First, only extensions using the
> to-be-removed option will fail. Second, removal of options reliably generates
> errors, rather than bogusly use one field for another, just because the types
> are compatible.

After discussing the topic in-person with Peter at FOSDEM. We agreed
that the best road forward was to not bother with MSVC for now. No-one
has actually expressed an interest in being able to build C++ extension
using MSVC, and the effort to support it is both non-trivial and not
without downsides to the rest of the codebase. We can always come back
to this later, possibly requiring C++20 on MSVC.

So I've removed that patch and now this patchset its goal is to improve
compatibiltity with the C++ flavor of GCC and Clang.

Patch 1 and 2 add some more macro calls to our test C++ extension. These
macros already work in GCC and Clang, this is purely to test for future
regressinos.

Patch 3 makes copyObject work when using GCC or Clang with -std=c++11 by
introducing pg_exprtype.

Patch 4 starts using pg_exprtype in more places.

I'm also working on some patches to support
StaticAssertVariableIsOfType, but I've run into some ICE compiler errors
of MSVC 2019.

Attachment Content-Type Size
v8-0001-Test-List-macros-in-C-extensions.patch text/x-patch 1.6 KB
v8-0002-Test-most-StaticAssert-macros-in-C-extensions.patch text/x-patch 1.6 KB
v8-0003-Support-using-copyObject-in-C.patch text/x-patch 2.9 KB
v8-0004-Use-pg_exprtype-instead-of-typeof.patch text/x-patch 3.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aya Iwata (Fujitsu) 2026-02-13 10:32:57 RE: [WIP]Vertical Clustered Index (columnar store extension) - take2
Previous Message Bertrand Drouvot 2026-02-13 10:24:52 Re: Adding locks statistics