Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJLhw-0006W0-9P for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2017 15:52:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJLhv-0002TV-Sy for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2017 15:52:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eJLhv-0002TL-Er for pgsql-hackers@lists.postgresql.org; Mon, 27 Nov 2017 15:52:31 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eJLhn-0002T4-7F for pgsql-hackers@postgresql.org; Mon, 27 Nov 2017 15:52:30 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 54FD621C176B; Mon, 27 Nov 2017 18:52:20 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from wp.localdomain (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 0C2A221C0644; Mon, 27 Nov 2017 18:52:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1511797940; bh=mownvGUvH4JcmrFEruKZgd7VTKGub8h7H8DExW4G2Vk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=mP4CP+0JP/+KatMQT/Ji3zKsizDCdyu4KU1lxjWq8puFVAiP5wcoRxwbI/tc1L3Ac BDMQ2Lb4CM9sFmxtYpxvDwmkMWO1HdN3W62pO2I6NYDWdS4NP2GNnh/uZVpyhxxgfj 6eSfTUbG0CEPicAy9DTi2chGLG772SOA3KS/mlxY= Date: Mon, 27 Nov 2017 18:52:18 +0300 From: Ildus Kurbangaliev To: Tomas Vondra Cc: pgsql-hackers@postgresql.org, Ildar Musin Subject: Re: [HACKERS] Custom compression methods Message-ID: <20171127185218.5cddad41@wp.localdomain> In-Reply-To: References: <20170907194236.4cefce96@wp.localdomain> <20170912175505.4afa11fd@wp.localdomain> <20171102152836.60c041e4@wp.localdomain> <20171114162356.52e3d388@wp.localdomain> <62e46a47-08a8-6e06-5e4f-6f52e0a13202@2ndquadrant.com> <20171121174717.69ecd8f4@wp.localdomain> <20171123123849.5a686d7b@wp.localdomain> <57daf28d-ed76-c364-a9ca-65d0ff71a36f@2ndquadrant.com> <20171124123800.034c9208@wp.localdomain> Organization: Postgres Professional X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) 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 On Sat, 25 Nov 2017 06:40:00 +0100 Tomas Vondra wrote: > Hi, > > I ran into another issue - after inserting some data into a table > with a tsvector column (without any compression defined), I can no > longer read the data. > > This is what I get in the console: > > db=# select max(md5(body_tsvector::text)) from messages; > ERROR: cache lookup failed for compression options 6432 > > and the stack trace looks like this: > > Breakpoint 1, get_cached_compression_options (cmoptoid=6432) at > tuptoaster.c:2563 > 2563 elog(ERROR, "cache lookup failed for > compression options %u", cmoptoid); > (gdb) bt > #0 get_cached_compression_options (cmoptoid=6432) at > tuptoaster.c:2563 #1 0x00000000004bf3da in toast_decompress_datum > (attr=0x2b44148) at tuptoaster.c:2390 > #2 0x00000000004c0c1e in heap_tuple_untoast_attr (attr=0x2b44148) at > tuptoaster.c:225 > #3 0x000000000083f976 in pg_detoast_datum (datum=) at > fmgr.c:1829 > #4 0x00000000008072de in tsvectorout (fcinfo=0x2b41e00) at > tsvector.c:315 #5 0x00000000005fae00 in ExecInterpExpr > (state=0x2b414b8, econtext=0x2b25ab0, isnull=) at > execExprInterp.c:1131 #6 0x000000000060bdf4 in > ExecEvalExprSwitchContext (isNull=0x7fffffe9bd37 "", > econtext=0x2b25ab0, state=0x2b414b8) > at ../../../src/include/executor/executor.h:299 > > It seems the VARATT_IS_CUSTOM_COMPRESSED incorrectly identifies the > value as custom-compressed for some reason. > > Not sure why, but the tsvector column is populated by a trigger that > simply does > > NEW.body_tsvector > := to_tsvector('english', strip_replies(NEW.body_plain)); > > If needed, the complete tool is here: > > https://bitbucket.org/tvondra/archie > Hi. This looks like a serious bug, but I couldn't reproduce it yet. Did you upgrade some old database or this bug happened after insertion of all data to new database? I tried using your 'archie' tool to download mailing lists and insert them to database, but couldn't catch any errors. -- --- Ildus Kurbangaliev Postgres Professional: http://www.postgrespro.com Russian Postgres Company