Rethink definition of pg_attribute.attcompression.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 27 May 2021 17:24:24 +0000 (13:24 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 27 May 2021 17:24:27 +0000 (13:24 -0400)
commite6241d8e030fbd2746b3ea3f44e728224298f35b
treee4bfc50561023459635cb9faf0873fee1e891013
parenta717e5c771610cf8607f2423ab3ab6b5d30f44ea
Rethink definition of pg_attribute.attcompression.

Redefine '\0' (InvalidCompressionMethod) as meaning "if we need to
compress, use the current setting of default_toast_compression".
This allows '\0' to be a suitable default choice regardless of
datatype, greatly simplifying code paths that initialize tupledescs
and the like.  It seems like a more user-friendly approach as well,
because now the default compression choice doesn't migrate into table
definitions, meaning that changing default_toast_compression is
usually sufficient to flip an installation's behavior; one needn't
tediously issue per-column ALTER SET COMPRESSION commands.

Along the way, fix a few minor bugs and documentation issues
with the per-column-compression feature.  Adopt more robust
APIs for SetIndexStorageProperties and GetAttributeCompression.

Bump catversion because typical contents of attcompression will now
be different.  We could get away without doing that, but it seems
better to ensure v14 installations all agree on this.  (We already
forced initdb for beta2, anyway.)

Discussion: https://postgr.es/m/626613.1621787110@sss.pgh.pa.us
29 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/config.sgml
doc/src/sgml/func.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/create_table.sgml
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/storage.sgml
src/backend/access/brin/brin_tuple.c
src/backend/access/common/indextuple.c
src/backend/access/common/toast_internals.c
src/backend/access/common/tupdesc.c
src/backend/access/heap/heapam_handler.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/genbki.pl
src/backend/catalog/heap.c
src/backend/commands/tablecmds.c
src/backend/parser/gram.y
src/backend/utils/misc/guc.c
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/describe.c
src/include/access/toast_compression.h
src/include/catalog/catversion.h
src/include/catalog/pg_attribute.h
src/test/regress/expected/compression.out
src/test/regress/expected/compression_1.out
src/test/regress/sql/compression.sql