Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGid5-0006CF-Ry for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Nov 2017 09:44:39 +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 1eGid5-0003au-6x for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Nov 2017 09:44:39 +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 1eGid5-0003ak-1o for pgsql-hackers@lists.postgresql.org; Mon, 20 Nov 2017 09:44:39 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eGid0-0003M1-De for pgsql-hackers@postgresql.org; Mon, 20 Nov 2017 09:44:38 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 7FEED21C1AEA; Mon, 20 Nov 2017 12:44:32 +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 5E20321C1756; Mon, 20 Nov 2017 12:44:29 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1511171072; bh=C1IoRyFQODtzWGx+NgSYoIITBiTYu9LAYCO475MU4ZM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=j7nwhbchU58OuWXRCugDZu7h1jziUsS6aT6WLoVc4D6gZTD3ky7GlgFBPOt067r0b 5mkaW+N4AnXVUdPzszyphtrRMViydwQ5Fcd12j+/eja6upOeH2P/xxHShUCceYsrzT 3Q7Lz3wjJXXTkAf2wwiE+YUdZ6S7vRNXQ+Z7b18g= Date: Mon, 20 Nov 2017 12:44:28 +0300 From: Ildus Kurbangaliev To: Tomas Vondra , Andres Freund Cc: Robert Haas , Oleg Bartunov , Craig Ringer , Peter Eisentraut , PostgreSQL Hackers Subject: Re: [HACKERS] Custom compression methods Message-ID: <20171120124428.6154f23f@wp.localdomain> In-Reply-To: References: <20170907194236.4cefce96@wp.localdomain> <20170912175505.4afa11fd@wp.localdomain> <5c84382f-1065-e9e8-dde8-4c1f5ae1007b@2ndquadrant.com> <20171102124101.5a28ecab@wp.localdomain> <20171115120928.31bee414@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 Mon, 20 Nov 2017 00:23:23 +0100 Tomas Vondra wrote: > On 11/15/2017 02:13 PM, Robert Haas wrote: > > On Wed, Nov 15, 2017 at 4:09 AM, Ildus Kurbangaliev > > wrote: > >> So in the next version of the patch I can just unlink the options > >> from compression methods and dropping compression method will not > >> affect already compressed tuples. They still could be > >> decompressed. > > > > I guess I don't understand how that can work. I mean, if somebody > > removes a compression method - i.e. uninstalls the library - and you > > don't have a way to make sure there are no tuples that can only be > > uncompressed by that library - then you've broken the database. > > Ideally, there should be a way to add a new compression method via > > an extension ... and then get rid of it and all dependencies > > thereupon. > > I share your confusion. Once you do DROP COMPRESSION METHOD, there > must be no remaining data compressed with it. But that's what the > patch is doing already - it enforces this using dependencies, as > usual. > > Ildus, can you explain what you meant? How could the data still be > decompressed after DROP COMPRESSION METHOD, and possibly after > removing the .so library? The removal of the .so library will broke all compressed tuples. I don't see a way to avoid it. I meant that DROP COMPRESSION METHOD could remove the record from 'pg_compression' table, but actually the compressed tuple needs only a record from 'pg_compression_opt' where its options are located. And there is dependency between an extension and the options so you can't just remove the extension without CASCADE, postgres will complain. Still it's a problem if the user used for example `SELECT INTO * FROM *` because postgres will copy compressed tuples, and there will not be any dependencies between destination and the options. Also thank you for review. I will look into it today. -- --- Ildus Kurbangaliev Postgres Professional: http://www.postgrespro.com Russian Postgres Company