Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZsgA-009UZJ-41 for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Jul 2025 14:55:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uZsg8-00Drwu-5s for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Jul 2025 14:55:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZsg7-00Drwf-U6 for pgsql-bugs@lists.postgresql.org; Thu, 10 Jul 2025 14:55:16 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uZsg6-006ah1-2v for pgsql-bugs@lists.postgresql.org; Thu, 10 Jul 2025 14:55:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56AEtDQR1525421; Thu, 10 Jul 2025 10:55:13 -0400 From: Tom Lane To: Thomas Thai cc: pgsql-bugs@lists.postgresql.org Subject: Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting In-reply-to: References: Comments: In-reply-to Thomas Thai message dated "Wed, 09 Jul 2025 21:35:56 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1525419.1752159313.1@sss.pgh.pa.us> Date: Thu, 10 Jul 2025 10:55:13 -0400 Message-ID: <1525420.1752159313@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Thai 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.