pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Thai <thomas.t.thai@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting
Date: Thu, 10 Jul 2025 10:55:13 -0400
Message-ID: <1525420.1752159313@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+ywuyaRRX6N5Kh16vMWoXEJxct+fEKQCk-8OKUswepYi2r-yg@mail.gmail.com>
References: <CA+ywuyaRRX6N5Kh16vMWoXEJxct+fEKQCk-8OKUswepYi2r-yg@mail.gmail.com>

Thomas Thai <thomas.t.thai@gmail.com> writes:
> PostgreSQL 18 beta crashes with a segmentation fault when casting strings
> to custom types. The crash occurs specifically in PostgreSQL's type-casting
> system, not in extension code.

The reason you're having a problem is that this is not a valid way to
store a custom type.  The representation has to be a single blob of
memory [1], and it has to be represented in a way that lets
type-independent code determine its length.  Typically that means
following the varlena-header rules.

			regards, tom lane

[1] Well, there is a notion of an "expanded" representation that
doesn't have to be a flat blob.  But you're not following the
rules for that either.





view thread (4+ messages)  latest in thread

Message-ID: <1525420.1752159313@sss.pgh.pa.us>
Permalink:  ../1525420.1752159313@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1525420.1752159313@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, thomas.t.thai@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting
  In-Reply-To: <1525420.1752159313@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox