pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>
Cc: pgsql-hackers@postgresql.org, Ildar Musin <i.musin@postgrespro.ru>
Subject: Re: [HACKERS] Custom compression methods
Date: Sat, 25 Nov 2017 06:40:00 +0100
Message-ID: <b969fa5a-bc2a-c220-c992-e6e0de34df14@2ndquadrant.com> (raw)
In-Reply-To: <e3378c06-d805-a3f5-6ea7-af2a2417361e@2ndquadrant.com>
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>
	<bfb3d34e-ba74-02cb-ca2a-43344866d9fd@2ndquadrant.com>
	<20171123123849.5a686d7b@wp.localdomain>
	<57daf28d-ed76-c364-a9ca-65d0ff71a36f@2ndquadrant.com>
	<20171124123800.034c9208@wp.localdomain>
	<e3378c06-d805-a3f5-6ea7-af2a2417361e@2ndquadrant.com>

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=<optimized out>) at
fmgr.c:1829
#4  0x00000000008072de in tsvectorout (fcinfo=0x2b41e00) at tsvector.c:315
#5  0x00000000005fae00 in ExecInterpExpr (state=0x2b414b8,
econtext=0x2b25ab0, isnull=<optimized out>) 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


regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (430+ messages)  latest in thread

Message-ID: <b969fa5a-bc2a-c220-c992-e6e0de34df14@2ndquadrant.com>
Permalink:  ../b969fa5a-bc2a-c220-c992-e6e0de34df14@2ndquadrant.com/
Also on:    postgresql.org/message-id/b969fa5a-bc2a-c220-c992-e6e0de34df14@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, i.kurbangaliev@postgrespro.ru, i.musin@postgrespro.ru
  Subject: Re: [HACKERS] Custom compression methods
  In-Reply-To: <b969fa5a-bc2a-c220-c992-e6e0de34df14@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox