@@ -1164,7 +1164,6 @@ update_trigger_func(PG_FUNCTION_ARGS)
11641164 */
11651165 key_name = get_attname (parent , prel -> attnum );
11661166 source_key = get_attnum (source_relid , key_name );
1167- // target_key = get_attnum(target_relid, key_name);
11681167 key = heap_getattr (new_tuple , source_key , source_tupdesc , & isnull );
11691168
11701169 /* Find partition it should go into */
@@ -1174,18 +1173,18 @@ update_trigger_func(PG_FUNCTION_ARGS)
11741173 if (target_relid == source_relid )
11751174 PG_RETURN_POINTER (new_tuple );
11761175
1177- /* TODO: probably should be another lock level */
1178- target_rel = heap_open (target_relid , RowExclusiveLock );
1179- target_tupdesc = target_rel -> rd_att ;
1180-
11811176 /* Read tuple id */
11821177 ctid = heap_getsysattr (old_tuple ,
11831178 SelfItemPointerAttributeNumber ,
11841179 source_tupdesc ,
11851180 & isnull );
11861181
1182+ /* Open partition table */
1183+ target_rel = heap_open (target_relid , RowExclusiveLock );
1184+ target_tupdesc = target_rel -> rd_att ;
1185+
11871186 /*
1188- * Else if it's a different partition then build a TupleConversionMap
1187+ * As it is different partition we need to build a TupleConversionMap
11891188 * between original partition and new one. And then do a convertation
11901189 */
11911190 conversion_map = convert_tuples_by_name (source_tupdesc ,
0 commit comments