1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Revert "Custom reloptions for table AM"

This reverts commit c95c25f9af due to multiple
design issues spotted after commit.

Reported-by: Jeff Davis
Discussion: https://postgr.es/m/11550b536211d5748bb2865ed6cb3502ff073bf7.camel%40j-davis.com
This commit is contained in:
Alexander Korotkov
2024-04-02 11:26:59 +03:00
parent 667e65aac3
commit 867cc7b6dd
8 changed files with 27 additions and 126 deletions

View File

@@ -24,7 +24,6 @@
#include "access/nbtree.h"
#include "access/reloptions.h"
#include "access/spgist_private.h"
#include "access/tableam.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "commands/tablespace.h"
@@ -1378,7 +1377,7 @@ untransformRelOptions(Datum options)
*/
bytea *
extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
const TableAmRoutine *tableam, amoptions_function amoptions)
amoptions_function amoptions)
{
bytea *options;
bool isnull;
@@ -1400,8 +1399,7 @@ extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
case RELKIND_RELATION:
case RELKIND_TOASTVALUE:
case RELKIND_MATVIEW:
options = tableam_reloptions(tableam, classForm->relkind,
datum, false);
options = heap_reloptions(classForm->relkind, datum, false);
break;
case RELKIND_PARTITIONED_TABLE:
options = partitioned_table_reloptions(datum, false);

View File

@@ -23,7 +23,6 @@
#include "access/heapam.h"
#include "access/heaptoast.h"
#include "access/multixact.h"
#include "access/reloptions.h"
#include "access/rewriteheap.h"
#include "access/syncscan.h"
#include "access/tableam.h"
@@ -2158,16 +2157,6 @@ heapam_relation_toast_am(Relation rel)
return rel->rd_rel->relam;
}
static bytea *
heapam_reloptions(char relkind, Datum reloptions, bool validate)
{
Assert(relkind == RELKIND_RELATION ||
relkind == RELKIND_TOASTVALUE ||
relkind == RELKIND_MATVIEW);
return heap_reloptions(relkind, reloptions, validate);
}
/* ------------------------------------------------------------------------
* Planner related callbacks for the heap AM
@@ -2673,7 +2662,6 @@ static const TableAmRoutine heapam_methods = {
.relation_needs_toast_table = heapam_relation_needs_toast_table,
.relation_toast_am = heapam_relation_toast_am,
.relation_fetch_toast_slice = heap_fetch_toast_slice,
.reloptions = heapam_reloptions,
.relation_estimate_size = heapam_estimate_rel_size,

View File

@@ -13,11 +13,9 @@
#include "access/tableam.h"
#include "access/xact.h"
#include "catalog/pg_am.h"
#include "commands/defrem.h"
#include "miscadmin.h"
#include "utils/guc_hooks.h"
#include "utils/syscache.h"
/*
@@ -100,29 +98,6 @@ GetTableAmRoutine(Oid amhandler)
return routine;
}
/*
* GetTableAmRoutineByAmOid
* Given the table access method oid get its TableAmRoutine struct, which
* will be palloc'd in the caller's memory context.
*/
const TableAmRoutine *
GetTableAmRoutineByAmOid(Oid amoid)
{
HeapTuple ht_am;
Form_pg_am amrec;
const TableAmRoutine *tableam = NULL;
ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(amoid));
if (!HeapTupleIsValid(ht_am))
elog(ERROR, "cache lookup failed for access method %u",
amoid);
amrec = (Form_pg_am) GETSTRUCT(ht_am);
tableam = GetTableAmRoutine(amrec->amhandler);
ReleaseSysCache(ht_am);
return tableam;
}
/* check_hook: validate new default_table_access_method */
bool
check_default_table_access_method(char **newval, void **extra, GucSource source)