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 1kUGMv-0004vA-9G for pgsql-bugs@arkaria.postgresql.org; Sun, 18 Oct 2020 21:37:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kUGMu-00027v-5l for pgsql-bugs@arkaria.postgresql.org; Sun, 18 Oct 2020 21:37:32 +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 1kUGMt-00027o-Vl for pgsql-bugs@lists.postgresql.org; Sun, 18 Oct 2020 21:37:31 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kUGMq-0005Iz-9N for pgsql-bugs@postgresql.org; Sun, 18 Oct 2020 21:37:31 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 70A2521FBF2CF for ; Sun, 18 Oct 2020 14:37:27 -0700 (MST) Date: Sun, 18 Oct 2020 14:37:27 -0700 (MST) From: pinker To: pgsql-bugs@postgresql.org Message-ID: <1603057047424-0.post@n3.nabble.com> In-Reply-To: <236292.1603052323@sss.pgh.pa.us> References: <1603050466566-0.post@n3.nabble.com> <1603050580276-0.post@n3.nabble.com> <235509.1603051243@sss.pgh.pa.us> <1603051414438-0.post@n3.nabble.com> <236292.1603052323@sss.pgh.pa.us> Subject: Re: Postgres 13 signal 11: Segmentation fault tested on 2 independent machines MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk cast to text those 2 columns helped: sut.schemaname::TEXT, sut.relname::TEXT so this function doesn't cause segmentation fault CREATE OR REPLACE FUNCTION vacuum_dead_size(i_now timestamp with time zone, OUT schemaname TEXT, OUT relname TEXT, OUT total_bytes NUMERIC, OUT dead_tup_size NUMERIC) RETURNS SETOF RECORD AS $$ WITH closest_metric_stat_user_tables AS ( SELECT now FROM stat_user_tables ORDER BY abs(now-$1) LIMIT 1 ), closest_metric_table_sizes AS ( SELECT now FROM table_sizes ORDER BY abs(now - $1) LIMIT 1 ) SELECT sut.schemaname::TEXT, sut.relname::TEXT, ts.total_bytes, 1::numeric FROM stat_user_tables sut LEFT JOIN table_sizes ts ON ts.table_name = sut.relname AND ts.table_schema = sut.schemaname WHERE ts.now = (SELECT now FROM closest_metric_table_sizes) AND sut.now = (SELECT now FROM closest_metric_stat_user_tables) ORDER BY 1; $$ LANGUAGE SQL; -- Sent from: https://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html