get rid of Pointer type, mostly
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-24T10:20:56Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove no longer needed casts from Pointer
- e158fd4d68f4 19 (unreleased) landed
-
Remove no longer needed casts to Pointer
- c6be3daa054a 19 (unreleased) landed
-
Change Pointer to void *
- 1b2bb5077e9e 19 (unreleased) landed
-
Don't rely on pointer arithmetic with Pointer type
- 756a43689324 19 (unreleased) landed
-
Use more appropriate DatumGet* function
- 8c6bbd674ed8 19 (unreleased) landed
-
Remove useless casts to Pointer
- 623801b3bdb4 19 (unreleased) landed
Attachments
- 0001-Remove-useless-casts-to-Pointer.patch (text/plain) patch 0001
- 0002-Use-better-DatumGet-function.patch (text/plain) patch 0002
- 0003-Don-t-rely-on-pointer-arithmetic-with-Pointer-type.patch (text/plain) patch 0003
- 0004-Change-Pointer-to-void.patch (text/plain) patch 0004
- 0005-Remove-no-longer-needed-casts-to-Pointer.patch (text/plain) patch 0005
- 0006-Remove-some-uses-of-the-Pointer-type.patch (text/plain) patch 0006
In a previous thread[0], the question was asked, 'Why do we bother with
a "Pointer" type?'. So I looked into get rid of it.
There are two stages to this. One is changing all code that wants to do
pointer arithmetic to use char * instead of relying on Pointer being
char *. Then we can change Pointer to be void * and remove a bunch of
casts.
The second is getting rid of uses of Pointer for variables where you
might as well use void * directly. These are actually not that many.
This gets rid of all uses, except in the GIN code, which is full of
Pointer use, and it's part of the documented API. I'm not touching
that, not least because this kind of code
Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
needs more brain-bending to understand that I'm prepared to spend. So
as far as I'm concerned, the pointer type can continue to exist as a
curiosity of the GIN API, but in all other places, it wasn't really
doing much of anything anyway.
[0]:
https://www.postgresql.org/message-id/CA%2BhUKG%2BNFKnr%3DK4oybwDvT35dW%3DVAjAAfiuLxp%2B5JeZSOV3nBg%40mail.gmail.com