Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLHEo-0002Da-03 for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Aug 2022 04:53:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLHEm-0007I3-Lm for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Aug 2022 04:53:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLHEm-0007Hu-DY for pgsql-bugs@lists.postgresql.org; Tue, 09 Aug 2022 04:53:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLHEk-0005r7-04 for pgsql-bugs@lists.postgresql.org; Tue, 09 Aug 2022 04:53:03 +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 2794qpCi774953; Tue, 9 Aug 2022 00:52:51 -0400 From: Tom Lane To: Japin Li cc: pgsql-bugs@lists.postgresql.org Subject: Re: Coredump with text search dictionary In-reply-to: References: Comments: In-reply-to Japin Li message dated "Tue, 09 Aug 2022 12:30:59 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <774951.1660020771.1@sss.pgh.pa.us> Date: Tue, 09 Aug 2022 00:52:51 -0400 Message-ID: <774952.1660020771@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Japin Li writes: > When attempting use text search, here is a core dump > (reported from my friend, Song Jinzhou). > CREATE TEXT SEARCH TEMPLATE public.my_ts_template ( > init = varchar_support, > lexize = dispell_lexize > ); > CREATE TEXT SEARCH DICTIONARY public.my_ts_dict ( > template = public.my_ts_template > ); There's a reason why CREATE TEXT SEARCH TEMPLATE is superuser-only: it's on you to supply valid parameters. varchar_support is a completely inappropriate choice for a TS template init function. The proposed patch doesn't add any meaningful amount of safety (just add some options to the dictionary, and it'll still crash). Moreover, the patch breaks init functions that would, say, want to insist that option X be provided. regards, tom lane