@@ -76,7 +76,7 @@ static ObjectAddress create_table_using_stmt(CreateStmt *create_stmt,
76
76
Oid relowner );
77
77
78
78
static void copy_foreign_keys (Oid parent_relid , Oid partition_oid );
79
- static void copy_acl_privileges (Oid parent_relid , Oid partition_relid );
79
+ static void postprocess_child_table_and_atts (Oid parent_relid , Oid partition_relid );
80
80
81
81
static Constraint * make_constraint_common (char * name , Node * raw_expr );
82
82
@@ -799,8 +799,8 @@ create_single_partition_internal(Oid parent_relid,
799
799
/* Make changes visible */
800
800
CommandCounterIncrement ();
801
801
802
- /* Copy ACL privileges of the parent table */
803
- copy_acl_privileges (parent_relid , partition_relid );
802
+ /* Copy ACL privileges of the parent table and set "attislocal" */
803
+ postprocess_child_table_and_atts (parent_relid , partition_relid );
804
804
}
805
805
else if (IsA (cur_stmt , CreateForeignTableStmt ))
806
806
{
@@ -880,9 +880,9 @@ create_table_using_stmt(CreateStmt *create_stmt, Oid relowner)
880
880
return table_addr ;
881
881
}
882
882
883
- /* Copy ACL privileges of parent table */
883
+ /* Copy ACL privileges of parent table and set "attislocal" = true */
884
884
static void
885
- copy_acl_privileges (Oid parent_relid , Oid partition_relid )
885
+ postprocess_child_table_and_atts (Oid parent_relid , Oid partition_relid )
886
886
{
887
887
Relation pg_class_rel ,
888
888
pg_attribute_rel ;
@@ -1039,10 +1039,16 @@ copy_acl_privileges(Oid parent_relid, Oid partition_relid)
1039
1039
/* Copy ItemPointer of this tuple */
1040
1040
iptr = subhtup -> t_self ;
1041
1041
1042
+ /* Change ACL of this column */
1042
1043
values [Anum_pg_attribute_attacl - 1 ] = acl_datum ; /* ACL array */
1043
1044
nulls [Anum_pg_attribute_attacl - 1 ] = acl_null ; /* do we have ACL? */
1044
1045
replaces [Anum_pg_attribute_attacl - 1 ] = true;
1045
1046
1047
+ /* Change 'attislocal' for DROP COLUMN */
1048
+ values [Anum_pg_attribute_attislocal - 1 ] = false; /* should not be local */
1049
+ nulls [Anum_pg_attribute_attislocal - 1 ] = false; /* NOT NULL */
1050
+ replaces [Anum_pg_attribute_attislocal - 1 ] = true;
1051
+
1046
1052
/* Build new tuple with parent's ACL */
1047
1053
subhtup = heap_modify_tuple (subhtup , pg_attribute_desc ,
1048
1054
values , nulls , replaces );
0 commit comments