aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-04-11 15:46:35 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2024-04-11 15:46:35 +0300
commitbc1e2092ebb857802a9713d0d3588079e2f0216a (patch)
treef55adc80b07150bcd7f5cbd50a9bfc89b3f301d6 /src/backend/utils/cache/relcache.c
parent87840b9741864dfdb9f63b0056e2783cdb49b8a5 (diff)
downloadpostgresql-bc1e2092ebb857802a9713d0d3588079e2f0216a.tar.gz
postgresql-bc1e2092ebb857802a9713d0d3588079e2f0216a.zip
Revert: Custom reloptions for table AM
This commit reverts 9bd99f4c26 and 422041542f per review by Andres Freund. Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 8fa09a5d755..3fe74dabd00 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -33,7 +33,6 @@
#include "access/htup_details.h"
#include "access/multixact.h"
#include "access/parallel.h"
-#include "access/relation.h"
#include "access/reloptions.h"
#include "access/sysattr.h"
#include "access/table.h"
@@ -465,30 +464,10 @@ RelationParseRelOptions(Relation relation, HeapTuple tuple)
{
bytea *options;
amoptions_function amoptsfn;
- CommonRdOptions *common = NULL;
- const TableAmRoutine *tableam = NULL;
relation->rd_options = NULL;
/*
- * Fill the rd_common_options with default values for appropriate
- * relkinds. The values might be later changed by extractRelOptions().
- */
- if (relation->rd_rel->relkind == RELKIND_RELATION ||
- relation->rd_rel->relkind == RELKIND_TOASTVALUE ||
- relation->rd_rel->relkind == RELKIND_MATVIEW)
- {
- common = MemoryContextAlloc(CacheMemoryContext,
- sizeof(CommonRdOptions));
- fill_default_common_reloptions(common);
- relation->rd_common_options = common;
- }
- else
- {
- relation->rd_common_options = NULL;
- }
-
- /*
* Look up any AM-specific parse function; fall out if relkind should not
* have options.
*/
@@ -499,7 +478,6 @@ RelationParseRelOptions(Relation relation, HeapTuple tuple)
case RELKIND_VIEW:
case RELKIND_MATVIEW:
case RELKIND_PARTITIONED_TABLE:
- tableam = relation->rd_tableam;
amoptsfn = NULL;
break;
case RELKIND_INDEX:
@@ -515,8 +493,7 @@ RelationParseRelOptions(Relation relation, HeapTuple tuple)
* we might not have any other for pg_class yet (consider executing this
* code for pg_class itself)
*/
- options = extractRelOptions(tuple, GetPgClassDescriptor(),
- tableam, amoptsfn, common);
+ options = extractRelOptions(tuple, GetPgClassDescriptor(), amoptsfn);
/*
* Copy parsed data into CacheMemoryContext. To guard against the
@@ -2323,8 +2300,6 @@ RelationReloadIndexInfo(Relation relation)
/* Reload reloptions in case they changed */
if (relation->rd_options)
pfree(relation->rd_options);
- if (relation->rd_common_options)
- pfree(relation->rd_common_options);
RelationParseRelOptions(relation, pg_class_tuple);
/* done with pg_class tuple */
heap_freetuple(pg_class_tuple);
@@ -2512,8 +2487,6 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc)
pfree(relation->rd_pubdesc);
if (relation->rd_options)
pfree(relation->rd_options);
- if (relation->rd_common_options)
- pfree(relation->rd_common_options);
if (relation->rd_indextuple)
pfree(relation->rd_indextuple);
table_free_rd_amcache(relation);
@@ -4253,8 +4226,6 @@ RelationCacheInitializePhase3(void)
/* Update rd_options while we have the tuple */
if (relation->rd_options)
pfree(relation->rd_options);
- if (relation->rd_common_options)
- pfree(relation->rd_common_options);
RelationParseRelOptions(relation, htup);
/*
@@ -6191,7 +6162,7 @@ load_relcache_init_file(bool shared)
has_not_null |= attr->attnotnull;
}
- /* next read the access method specific fields */
+ /* next read the access method specific field */
if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed;
if (len > 0)
@@ -6207,21 +6178,6 @@ load_relcache_init_file(bool shared)
rel->rd_options = NULL;
}
- if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
- goto read_failed;
- if (len > 0)
- {
- if (len != sizeof(CommonRdOptions))
- goto read_failed;
- rel->rd_common_options = palloc(len);
- if (fread(rel->rd_common_options, 1, len, fp) != len)
- goto read_failed;
- }
- else
- {
- rel->rd_common_options = NULL;
- }
-
/* mark not-null status */
if (has_not_null)
{
@@ -6623,15 +6579,11 @@ write_relcache_init_file(bool shared)
ATTRIBUTE_FIXED_PART_SIZE, fp);
}
- /* next, do the access method specific fields */
+ /* next, do the access method specific field */
write_item(rel->rd_options,
(rel->rd_options ? VARSIZE(rel->rd_options) : 0),
fp);
- write_item(rel->rd_common_options,
- (rel->rd_common_options ? sizeof(CommonRdOptions) : 0),
- fp);
-
/*
* If it's an index, there's more to do. Note we explicitly ignore
* partitioned indexes here.