Skip to content

Commit 92251fb

Browse files
committed
rename copy_acl_privileges() -> postprocess_child_table_and_atts(), set 'attislocal' = true for child attributes
1 parent dd4b33b commit 92251fb

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/partition_creation.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static ObjectAddress create_table_using_stmt(CreateStmt *create_stmt,
7676
Oid relowner);
7777

7878
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);
8080

8181
static Constraint *make_constraint_common(char *name, Node *raw_expr);
8282

@@ -799,8 +799,8 @@ create_single_partition_internal(Oid parent_relid,
799799
/* Make changes visible */
800800
CommandCounterIncrement();
801801

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);
804804
}
805805
else if (IsA(cur_stmt, CreateForeignTableStmt))
806806
{
@@ -880,9 +880,9 @@ create_table_using_stmt(CreateStmt *create_stmt, Oid relowner)
880880
return table_addr;
881881
}
882882

883-
/* Copy ACL privileges of parent table */
883+
/* Copy ACL privileges of parent table and set "attislocal" = true */
884884
static void
885-
copy_acl_privileges(Oid parent_relid, Oid partition_relid)
885+
postprocess_child_table_and_atts(Oid parent_relid, Oid partition_relid)
886886
{
887887
Relation pg_class_rel,
888888
pg_attribute_rel;
@@ -1039,10 +1039,16 @@ copy_acl_privileges(Oid parent_relid, Oid partition_relid)
10391039
/* Copy ItemPointer of this tuple */
10401040
iptr = subhtup->t_self;
10411041

1042+
/* Change ACL of this column */
10421043
values[Anum_pg_attribute_attacl - 1] = acl_datum; /* ACL array */
10431044
nulls[Anum_pg_attribute_attacl - 1] = acl_null; /* do we have ACL? */
10441045
replaces[Anum_pg_attribute_attacl - 1] = true;
10451046

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+
10461052
/* Build new tuple with parent's ACL */
10471053
subhtup = heap_modify_tuple(subhtup, pg_attribute_desc,
10481054
values, nulls, replaces);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy