Commit 226e2be3 authored by Robert Haas's avatar Robert Haas

More code cleanup for configurable TOAST compression.

Remove unused macro. Fix confusion about whether a TOAST compression
method is identified by an OID or a char.

Justin Pryzby

Discussion: http://postgr.es/m/20210321235544.GD4203@telsasoft.com
parent 909b449e
...@@ -7847,6 +7847,7 @@ SetIndexStorageProperties(Relation rel, Relation attrelation, ...@@ -7847,6 +7847,7 @@ SetIndexStorageProperties(Relation rel, Relation attrelation,
index_close(indrel, lockmode); index_close(indrel, lockmode);
} }
} }
/* /*
* ALTER TABLE ALTER COLUMN SET STORAGE * ALTER TABLE ALTER COLUMN SET STORAGE
* *
...@@ -15070,7 +15071,7 @@ ATExecSetCompression(AlteredTableInfo *tab, ...@@ -15070,7 +15071,7 @@ ATExecSetCompression(AlteredTableInfo *tab,
AttrNumber attnum; AttrNumber attnum;
char *compression; char *compression;
char typstorage; char typstorage;
Oid cmoid; char cmethod;
ObjectAddress address; ObjectAddress address;
Assert(IsA(newValue, String)); Assert(IsA(newValue, String));
...@@ -15104,10 +15105,10 @@ ATExecSetCompression(AlteredTableInfo *tab, ...@@ -15104,10 +15105,10 @@ ATExecSetCompression(AlteredTableInfo *tab,
format_type_be(atttableform->atttypid)))); format_type_be(atttableform->atttypid))));
/* get the attribute compression method. */ /* get the attribute compression method. */
cmoid = GetAttributeCompression(atttableform, compression); cmethod = GetAttributeCompression(atttableform, compression);
/* update pg_attribute entry */ /* update pg_attribute entry */
atttableform->attcompression = cmoid; atttableform->attcompression = cmethod;
CatalogTupleUpdate(attrel, &tuple->t_self, tuple); CatalogTupleUpdate(attrel, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(RelationRelationId, InvokeObjectPostAlterHook(RelationRelationId,
...@@ -15118,7 +15119,7 @@ ATExecSetCompression(AlteredTableInfo *tab, ...@@ -15118,7 +15119,7 @@ ATExecSetCompression(AlteredTableInfo *tab,
* Apply the change to indexes as well (only for simple index columns, * Apply the change to indexes as well (only for simple index columns,
* matching behavior of index.c ConstructTupleDescriptor()). * matching behavior of index.c ConstructTupleDescriptor()).
*/ */
SetIndexStorageProperties(rel, attrel, attnum, cmoid, '\0', lockmode); SetIndexStorageProperties(rel, attrel, attnum, cmethod, '\0', lockmode);
heap_freetuple(tuple); heap_freetuple(tuple);
......
...@@ -50,8 +50,6 @@ typedef enum ToastCompressionId ...@@ -50,8 +50,6 @@ typedef enum ToastCompressionId
errdetail("This functionality requires the server to be built with lz4 support."), \ errdetail("This functionality requires the server to be built with lz4 support."), \
errhint("You need to rebuild PostgreSQL using --with-lz4."))) errhint("You need to rebuild PostgreSQL using --with-lz4.")))
#define IsValidCompression(cm) ((cm) != InvalidCompressionMethod)
#define IsStorageCompressible(storage) ((storage) != TYPSTORAGE_PLAIN && \ #define IsStorageCompressible(storage) ((storage) != TYPSTORAGE_PLAIN && \
(storage) != TYPSTORAGE_EXTERNAL) (storage) != TYPSTORAGE_EXTERNAL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment