@@ -73,12 +73,10 @@ static void modify_range_constraint(Oid partition_relid,
73
73
const Bound * lower ,
74
74
const Bound * upper );
75
75
static char * get_qualified_rel_name (Oid relid );
76
- static void drop_table_by_oid (Oid relid , bool concurrent );
76
+ static void drop_table_by_oid (Oid relid );
77
77
static bool interval_is_trivial (Oid atttype ,
78
78
Datum interval ,
79
79
Oid interval_type );
80
- static void remove_inheritance (Oid parent_relid , Oid partition_relid );
81
-
82
80
83
81
/*
84
82
* -----------------------------
@@ -740,9 +738,6 @@ merge_range_partitions_internal(Oid parent_relid, Oid *parts, uint32 nparts)
740
738
NULL ,
741
739
NULL );
742
740
743
- /* should be invalidated */
744
- //Assert(!prel->valid);
745
-
746
741
/* Make new relation visible */
747
742
CommandCounterIncrement ();
748
743
@@ -767,22 +762,11 @@ merge_range_partitions_internal(Oid parent_relid, Oid *parts, uint32 nparts)
767
762
768
763
SPI_finish ();
769
764
770
- /*
771
- * Now detach these partitions.
772
- * this would get AccessExclusiveLock.
773
- */
774
- for (i = 0 ; i < nparts ; i ++ )
775
- remove_inheritance (parent_relid , parts [i ]);
776
-
777
765
/* Now we can drop the partitions */
778
766
for (i = 0 ; i < nparts ; i ++ )
779
767
{
780
- /*
781
- * we should get AccessExclusiveLock anyway, because logic of
782
- * ALTER TABLE .. NO INHERIT that we did before could change
783
- */
784
768
LockRelationOid (parts [i ], AccessExclusiveLock );
785
- drop_table_by_oid (parts [i ], false );
769
+ drop_table_by_oid (parts [i ]);
786
770
}
787
771
}
788
772
@@ -844,7 +828,7 @@ drop_range_partition_expand_next(PG_FUNCTION_ARGS)
844
828
}
845
829
846
830
/* Finally drop this partition */
847
- drop_table_by_oid (relid , false );
831
+ drop_table_by_oid (relid );
848
832
849
833
PG_RETURN_VOID ();
850
834
}
@@ -1263,7 +1247,7 @@ get_qualified_rel_name(Oid relid)
1263
1247
* Drop table using it's Oid
1264
1248
*/
1265
1249
static void
1266
- drop_table_by_oid (Oid relid , bool concurrent )
1250
+ drop_table_by_oid (Oid relid )
1267
1251
{
1268
1252
DropStmt * n = makeNode (DropStmt );
1269
1253
const char * relname = get_qualified_rel_name (relid );
@@ -1275,30 +1259,7 @@ drop_table_by_oid(Oid relid, bool concurrent)
1275
1259
n -> arguments = NIL ;
1276
1260
#endif
1277
1261
n -> behavior = DROP_RESTRICT ; /* default behavior */
1278
- n -> concurrent = concurrent ;
1262
+ n -> concurrent = false ;
1279
1263
1280
1264
RemoveRelations (n );
1281
1265
}
1282
-
1283
- /* Remove inheritance for partition */
1284
- static void
1285
- remove_inheritance (Oid parent_relid , Oid partition_relid )
1286
- {
1287
- AlterTableStmt * stmt = makeNode (AlterTableStmt );
1288
- AlterTableCmd * cmd = makeNode (AlterTableCmd );
1289
- LOCKMODE lockmode ;
1290
-
1291
- stmt -> relation = makeRangeVarFromNameList (
1292
- stringToQualifiedNameList (get_qualified_rel_name (partition_relid )));
1293
- stmt -> relkind = OBJECT_TABLE ;
1294
- stmt -> cmds = list_make1 (cmd );
1295
- stmt -> missing_ok = false;
1296
-
1297
- cmd -> subtype = AT_DropInherit ;
1298
- cmd -> def = (Node * ) makeRangeVarFromNameList (
1299
- stringToQualifiedNameList (get_qualified_rel_name (parent_relid )));
1300
-
1301
- lockmode = AlterTableGetLockLevel (stmt -> cmds );
1302
- LockRelationOid (partition_relid , lockmode );
1303
- AlterTable (partition_relid , lockmode , stmt );
1304
- }
0 commit comments