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 1tByXa-007oqe-NX for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Nov 2024 15:47:22 +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 1tByXX-00ATfZ-VN for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Nov 2024 15:47:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tByXX-00ATfR-NC for pgsql-bugs@lists.postgresql.org; Fri, 15 Nov 2024 15:47:20 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tByXU-00260d-LQ for pgsql-bugs@lists.postgresql.org; Fri, 15 Nov 2024 15:47:19 +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 4AFFlEXT2448487; Fri, 15 Nov 2024 10:47:14 -0500 From: Tom Lane To: Tomas Vondra cc: Tender Wang , 503699317@qq.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18705: Segmentation fault when create brin index on user-defined type. In-reply-to: References: <18705-29cc90ff31682f19@postgresql.org> Comments: In-reply-to Tomas Vondra message dated "Fri, 15 Nov 2024 16:38:45 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2448485.1731685634.1@sss.pgh.pa.us> Date: Fri, 15 Nov 2024 10:47:14 -0500 Message-ID: <2448486.1731685634@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tomas Vondra writes: > On 11/15/24 07:17, Tender Wang wrote: >> Can we report errors not crash if users pass an unexpected function? Read up on the halting problem. > I think it might be improved to do some checks, yes. The CREATE OPERATOR > CLASS should be able to signatures of the functions - it's AM-specific, > and there's a limit how much can be checked. For example these functions > have "internal" arguments, which can be an arbitrary pointer. We already have amvalidate, which would certainly have caught anything as egregiously wrong as this example. I do not remember why that's not a forced step of CREATE OPERATOR CLASS, but I'm sure there was a good reason for making it separate. regards, tom lane