Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 65786ab

Browse files
committed
take lock in add_to_pathman_config()
1 parent d62f80e commit 65786ab

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/pl_funcs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,9 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
725725
else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
726726
errmsg("'parent_relid' should not be NULL")));
727727

728+
/* Lock relation */
729+
xact_lock_rel_exclusive(relid, true);
730+
728731
/* Check that relation exists */
729732
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relid)))
730733
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -792,11 +795,11 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
792795
/*
793796
* Initialize columns (partrel, attname, parttype, range_interval).
794797
*/
795-
values[Anum_pathman_config_partrel - 1] = ObjectIdGetDatum(relid);
796-
isnull[Anum_pathman_config_partrel - 1] = false;
798+
values[Anum_pathman_config_partrel - 1] = ObjectIdGetDatum(relid);
799+
isnull[Anum_pathman_config_partrel - 1] = false;
797800

798-
values[Anum_pathman_config_parttype - 1] = Int32GetDatum(parttype);
799-
isnull[Anum_pathman_config_parttype - 1] = false;
801+
values[Anum_pathman_config_parttype - 1] = Int32GetDatum(parttype);
802+
isnull[Anum_pathman_config_parttype - 1] = false;
800803

801804
values[Anum_pathman_config_expr - 1] = CStringGetTextDatum(expression);
802805
isnull[Anum_pathman_config_expr - 1] = false;

src/relation_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ parse_partitioning_expression(const Oid relid,
590590
return ((ResTarget *) linitial(select_stmt->targetList))->val;
591591
}
592592

593-
/* Parse partitioning expression and return its type and nodeToString() */
593+
/* Parse partitioning expression and return its type and nodeToString() as TEXT */
594594
Datum
595595
cook_partitioning_expression(const Oid relid,
596596
const char *expr_cstr,

0 commit comments

Comments
 (0)