Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eITCL-0006UI-Cy for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Nov 2017 05:40:17 +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 1eITCK-0004kh-5G for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Nov 2017 05:40:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eITCJ-0004kA-QL for pgsql-hackers@lists.postgresql.org; Sat, 25 Nov 2017 05:40:16 +0000 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eITC9-00051g-Vi for pgsql-hackers@postgresql.org; Sat, 25 Nov 2017 05:40:15 +0000 Received: by mail-wr0-x22b.google.com with SMTP id z75so20563691wrc.5 for ; Fri, 24 Nov 2017 21:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UdJiFewNsicp0fIa74D6WQ3QDpOWVymVwvGj5klSW5M=; b=w3p3fiSbDXLtUkvh1zHamKCKfvT8VjD3/D0kjdGDZo1edXzVJubllU1j2CZlrjd20R N8EdoMOWDNOInhQaSHFrIW+cmKhJ052LjWHWGpJ5BwNJ6X/SZLZbspELOS2HZdS6OG6r EQ1cEx92MzHI4LlZRkJxiTmRNPQqKiqTJKCWOPtBqR7TtcKzhR0EVZudTi78ewz45Q9O 7XlhFgRucSinwNHtr2YbrynWrgkiN4MQ8heqBJauMrH4I1JXn75taVQ3bhCkmvM7F0Wc /8MNtN4GVNGZwbMBn0Is7NwjKJw+c2b62LxAjJr7agpvQPIL6gQQtu2QC7dO0tG/8c+u MO2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UdJiFewNsicp0fIa74D6WQ3QDpOWVymVwvGj5klSW5M=; b=IuO27kuo8XCGaLwDOT2EEr5uwkiyhnOSdq9jDOeqvut7x9hyZuNZ8N6IQR1ELrq0h8 uw27iFl9FtCFGJYx2sP3s94dMUUlOCxwl4bmisqwDFFiJFTaeFZChRc6P5+qYwuA/1rV B0+6PfwYHaIr6T/ZnYo59m2VCHzMCGBM/uKIpYaF6i7hPwy+Acuf7Fl8xsN3q6Jy3bh+ AzXdCO5GE8UAm7laH0mFvRTTYfJv26rgDbmyKFRC19og1F58HFTf3eUydaqBgPzlsOsq joehH4AVLyWB47EFUPRx+cMmpVVYQEyXFHTlpEG1DVv/XLK3ASWky5LzUQagsO5yvStz /fWQ== X-Gm-Message-State: AJaThX7iYIuttgZfFr2im+kT5Ytg9bVdy/ZKYrah9r5W77kEPgtxEPzT YfqcUh88E2y0qPJK+XH4FKiAFA== X-Google-Smtp-Source: AGs4zMZTS7YwbraPoeR34lxlHD7N5gDFERvkeWF8aIn1GrSmSt8XVFAjdkzt7ozSVhmbZpeSp2fMzg== X-Received: by 10.223.167.76 with SMTP id e12mr3179602wrd.204.1511588404289; Fri, 24 Nov 2017 21:40:04 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id y2sm8695084wra.18.2017.11.24.21.40.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 21:40:03 -0800 (PST) Subject: Re: [HACKERS] Custom compression methods From: Tomas Vondra To: Ildus Kurbangaliev Cc: pgsql-hackers@postgresql.org, Ildar Musin 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> Message-ID: Date: Sat, 25 Nov 2017 06:40:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services