Adjusting my IDE expectations for a C extension development

From: postgres(at)lobeshare(dot)co(dot)za
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Adjusting my IDE expectations for a C extension development
Date: 2025-08-19 16:23:07
Message-ID: 12e8cf402e58da68ac2f58056282d259@lobeshare.co.za
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Folks,

Last time I wrote a C extension for PostgreSQL it was easy enough to
write, debug and test the C functions separately as a terminal
application before dropping main() into a #ifdef DEBUG to compile the
extension with prescribed make command invoking PGXS. To get VSCode
C/C++ Intellisense to not see everythjng as errors I just had to set the
include path it uses to see find postgres.h

That was then, but now I’m writing another extension and this time my C
code has to interact with PostgreSQL memory contexts and management and
I’m going to need to get some form of visibility of what’s happening
run-time.

The trouble is I’m getting nowhere fast trying to find a setup in VSCode
that will let me build and hopefully debug my extension within that
environment.

What do you do? The only VS Code extension making any reference to PGXS
is PostgreSQL Hacker Helper which hasn’t been updated forever. Internet
“wisdom” suggests replacing PGXS with CMake but I’d like to remain as
default and standard as possible which I see as sticking with PGXS,
right?

Am I barking up the wrong tree with VSCode in this situation? Though my
primary desktop is macOS I do have a Win11 machine with Visual Studio
Community but no local PostgreSQL yet and several Linux (mostly Ubuntu)
servers including some with running PostgreSQL servers.

If I knew it was the only feasible way I can easily pivot to developing
the extension purely the Linux terminal way - I can still switch into vi
mode when I have to.

Whether VS Code is in the mix or a command line toolchain my only
option, I’d still like to know what toolchain and basic workflow you’d
use or recommend for active c extension development today.

P.S. I have no need for or skills pertaining to C++ (nor Objective C, C#
or Java for that matter).

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-08-19 16:44:06 Re: Performance issue on temporary relations
Previous Message Bruce Momjian 2025-08-19 16:21:41 Re: Changing the state of data checksums in a running cluster