Skip to content

Commit 226e2be

Browse files
committed
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/[email protected]
1 parent 909b449 commit 226e2be

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/backend/commands/tablecmds.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -7847,6 +7847,7 @@ SetIndexStorageProperties(Relation rel, Relation attrelation,
78477847
index_close(indrel, lockmode);
78487848
}
78497849
}
7850+
78507851
/*
78517852
* ALTER TABLE ALTER COLUMN SET STORAGE
78527853
*
@@ -15070,7 +15071,7 @@ ATExecSetCompression(AlteredTableInfo *tab,
1507015071
AttrNumber attnum;
1507115072
char *compression;
1507215073
char typstorage;
15073-
Oid cmoid;
15074+
char cmethod;
1507415075
ObjectAddress address;
1507515076

1507615077
Assert(IsA(newValue, String));
@@ -15104,10 +15105,10 @@ ATExecSetCompression(AlteredTableInfo *tab,
1510415105
format_type_be(atttableform->atttypid))));
1510515106

1510615107
/* get the attribute compression method. */
15107-
cmoid = GetAttributeCompression(atttableform, compression);
15108+
cmethod = GetAttributeCompression(atttableform, compression);
1510815109

1510915110
/* update pg_attribute entry */
15110-
atttableform->attcompression = cmoid;
15111+
atttableform->attcompression = cmethod;
1511115112
CatalogTupleUpdate(attrel, &tuple->t_self, tuple);
1511215113

1511315114
InvokeObjectPostAlterHook(RelationRelationId,
@@ -15118,7 +15119,7 @@ ATExecSetCompression(AlteredTableInfo *tab,
1511815119
* Apply the change to indexes as well (only for simple index columns,
1511915120
* matching behavior of index.c ConstructTupleDescriptor()).
1512015121
*/
15121-
SetIndexStorageProperties(rel, attrel, attnum, cmoid, '\0', lockmode);
15122+
SetIndexStorageProperties(rel, attrel, attnum, cmethod, '\0', lockmode);
1512215123

1512315124
heap_freetuple(tuple);
1512415125

src/include/access/toast_compression.h

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ typedef enum ToastCompressionId
5050
errdetail("This functionality requires the server to be built with lz4 support."), \
5151
errhint("You need to rebuild PostgreSQL using --with-lz4.")))
5252

53-
#define IsValidCompression(cm) ((cm) != InvalidCompressionMethod)
54-
5553
#define IsStorageCompressible(storage) ((storage) != TYPSTORAGE_PLAIN && \
5654
(storage) != TYPSTORAGE_EXTERNAL)
5755

0 commit comments

Comments
 (0)