@@ -715,7 +715,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
715
715
ObjectAddress address;
716
716
LOCKMODE parentLockmode;
717
717
Oid accessMethodId = InvalidOid;
718
- const TableAmRoutine *tableam = NULL;
719
718
720
719
/*
721
720
* Truncate relname to appropriate length (probably a waste of time, as
@@ -851,28 +850,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
851
850
if (!OidIsValid(ownerId))
852
851
ownerId = GetUserId();
853
852
854
- /*
855
- * For relations with table AM and partitioned tables, select access
856
- * method to use: an explicitly indicated one, or (in the case of a
857
- * partitioned table) the parent's, if it has one.
858
- */
859
- if (stmt->accessMethod != NULL)
860
- {
861
- Assert(RELKIND_HAS_TABLE_AM(relkind) || relkind == RELKIND_PARTITIONED_TABLE);
862
- accessMethodId = get_table_am_oid(stmt->accessMethod, false);
863
- }
864
- else if (RELKIND_HAS_TABLE_AM(relkind) || relkind == RELKIND_PARTITIONED_TABLE)
865
- {
866
- if (stmt->partbound)
867
- {
868
- Assert(list_length(inheritOids) == 1);
869
- accessMethodId = get_rel_relam(linitial_oid(inheritOids));
870
- }
871
-
872
- if (RELKIND_HAS_TABLE_AM(relkind) && !OidIsValid(accessMethodId))
873
- accessMethodId = get_table_am_oid(default_table_access_method, false);
874
- }
875
-
876
853
/*
877
854
* Parse and validate reloptions, if any.
878
855
*/
@@ -881,12 +858,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
881
858
882
859
switch (relkind)
883
860
{
884
- case RELKIND_RELATION:
885
- case RELKIND_TOASTVALUE:
886
- case RELKIND_MATVIEW:
887
- tableam = GetTableAmRoutineByAmOid(accessMethodId);
888
- (void) tableam_reloptions(tableam, relkind, reloptions, true);
889
- break;
890
861
case RELKIND_VIEW:
891
862
(void) view_reloptions(reloptions, true);
892
863
break;
@@ -895,7 +866,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
895
866
break;
896
867
default:
897
868
(void) heap_reloptions(relkind, reloptions, true);
898
- break;
899
869
}
900
870
901
871
if (stmt->ofTypename)
@@ -987,6 +957,28 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
987
957
}
988
958
}
989
959
960
+ /*
961
+ * For relations with table AM and partitioned tables, select access
962
+ * method to use: an explicitly indicated one, or (in the case of a
963
+ * partitioned table) the parent's, if it has one.
964
+ */
965
+ if (stmt->accessMethod != NULL)
966
+ {
967
+ Assert(RELKIND_HAS_TABLE_AM(relkind) || relkind == RELKIND_PARTITIONED_TABLE);
968
+ accessMethodId = get_table_am_oid(stmt->accessMethod, false);
969
+ }
970
+ else if (RELKIND_HAS_TABLE_AM(relkind) || relkind == RELKIND_PARTITIONED_TABLE)
971
+ {
972
+ if (stmt->partbound)
973
+ {
974
+ Assert(list_length(inheritOids) == 1);
975
+ accessMethodId = get_rel_relam(linitial_oid(inheritOids));
976
+ }
977
+
978
+ if (RELKIND_HAS_TABLE_AM(relkind) && !OidIsValid(accessMethodId))
979
+ accessMethodId = get_table_am_oid(default_table_access_method, false);
980
+ }
981
+
990
982
/*
991
983
* Create the relation. Inherited defaults and constraints are passed in
992
984
* for immediate handling --- since they don't need parsing, they can be
@@ -15536,8 +15528,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
15536
15528
case RELKIND_RELATION:
15537
15529
case RELKIND_TOASTVALUE:
15538
15530
case RELKIND_MATVIEW:
15539
- (void) table_reloptions(rel, rel->rd_rel->relkind,
15540
- newOptions, true);
15531
+ (void) heap_reloptions(rel->rd_rel->relkind, newOptions, true);
15541
15532
break;
15542
15533
case RELKIND_PARTITIONED_TABLE:
15543
15534
(void) partitioned_table_reloptions(newOptions, true);
0 commit comments