Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting

Поиск
Список
Период
Сортировка
От Aleksander Alekseev
Тема Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting
Дата
Msg-id CAJ7c6TMT93iF5F3hm8taf04JGgd6CMWGQgDqF__2EJbHR0R9OA@mail.gmail.com
обсуждение исходный текст
Ответ на PostgreSQL 18 beta1 - Segmentation fault on custom type casting  (Thomas Thai <thomas.t.thai@gmail.com>)
Список pgsql-bugs
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



В списке pgsql-bugs по дате отправления: