On Mon, Dec 11, 2017 at 7:55 AM, Ildus Kurbangaliev <i.kurbangal...@postgrespro.ru> wrote: > On Fri, 8 Dec 2017 15:12:42 -0500 > Robert Haas <robertmh...@gmail.com> wrote: >> Maybe a better idea is ALTER COLUMN SET COMPRESSION x1, x2, x3 ... >> meaning that x1 is the default for new tuples but x2, x3, etc. are >> still allowed if present. If you issue a command that only adds >> things to the list, no table rewrite happens, but if you remove >> anything, then it does. > > I like this idea, but maybe it should be something like ALTER COLUMN > SET COMPRESSION x1 [ PRESERVE x2, x3 ]? 'PRESERVE' is already used in > syntax and this syntax will show better which one is current and which > ones should be kept.
Sure, that works. And I think pglz should exist in the catalog as a predefined, undroppable compression algorithm. So the default for each column initially is: SET COMPRESSION pglz And if you want to rewrite the table with your awesome custom thing, you can do SET COMPRESSION awesome But if you want to just use the awesome custom thing for new rows, you can do SET COMPRESSION awesome PRESERVE pglz Then we can get all the dependencies right, pg_upgrade works, users have total control of rewrite behavior, and everything is great. :-) -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company