Hi,
> PostgreSQL 18 beta crashes with a segmentation fault when casting strings to custom types. The crash occurs
specificallyin PostgreSQL's type-casting system, not in extension code.
> [...]
The provided code is wrong. It doesn't work with PG17 either.
``
eax=# SELECT create_simple_type('test');
NOTICE: create_simple_type: Creating SimpleType with value 'test'
NOTICE: create_simple_type: About to return pointer 0x57ec7ef80018
with value 'test'
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
```
The reason apparently is that you are not using the varlena header.
Take a look at Jsonb implementation as an example,
src/include/utils/jsonb.h