Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit628d208

Browse files
committed
[PGPRO-13804] Save original RTEPermissionInfo array before adding a new element
1 parent73aafcf commit628d208

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎src/partition_filter.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ typedef struct
5151
{
5252
intestate_alloc_result_rels;/* number of allocated result rels */
5353
boolestate_not_modified;/* did we modify EState somehow? */
54+
#ifPG_VERSION_NUM >=160000
55+
boolperminfo_not_modified;/* did we modify EState somehow? */
56+
#endif
5457
}estate_mod_data;
5558

5659
/*
@@ -95,6 +98,9 @@ static Node *fix_returning_list_mutator(Node *node, void *state);
9598

9699
staticIndexappend_rte_to_estate(EState*estate,RangeTblEntry*rte,Relationchild_rel);
97100
staticintappend_rri_to_estate(EState*estate,ResultRelInfo*rri);
101+
#ifPG_VERSION_NUM >=160000
102+
staticvoidprepare_estate_for_append_perminfo(EState*estate);
103+
#endif
98104

99105
staticvoidpf_memcxt_callback(void*arg);
100106
staticestate_mod_data*fetch_estate_mod_data(EState*estate);
@@ -337,6 +343,7 @@ scan_result_parts_storage(EState *estate, ResultPartsStorage *parts_storage,
337343
parent_perminfo=getRTEPermissionInfo(estate->es_rteperminfos,init_rte);
338344

339345
child_rte->perminfoindex=0;/* expected by addRTEPermissionInfo() */
346+
prepare_estate_for_append_perminfo(estate);
340347
child_perminfo=addRTEPermissionInfo(&estate->es_rteperminfos,child_rte);
341348
child_perminfo->requiredPerms=parent_perminfo->requiredPerms;
342349
child_perminfo->checkAsUser=parent_perminfo->checkAsUser;
@@ -1449,6 +1456,22 @@ fix_returning_list_mutator(Node *node, void *state)
14491456
* -------------------------------------
14501457
*/
14511458

1459+
#ifPG_VERSION_NUM >=160000
1460+
/* Prepare estate->es_rteperminfos for append RTEPermissionInfo */
1461+
staticvoid
1462+
prepare_estate_for_append_perminfo(EState*estate)
1463+
{
1464+
estate_mod_data*emd_struct=fetch_estate_mod_data(estate);
1465+
1466+
/* Copy estate->es_rteperminfos if it's first time expansion. */
1467+
if (emd_struct->perminfo_not_modified)
1468+
estate->es_rteperminfos=list_copy(estate->es_rteperminfos);
1469+
1470+
/* Update estate_mod_data. */
1471+
emd_struct->perminfo_not_modified= false;
1472+
}
1473+
#endif
1474+
14521475
/* Append RangeTblEntry 'rte' to estate->es_range_table */
14531476
staticIndex
14541477
append_rte_to_estate(EState*estate,RangeTblEntry*rte,Relationchild_rel)
@@ -1594,6 +1617,9 @@ fetch_estate_mod_data(EState *estate)
15941617
/* Have to create a new one */
15951618
emd_struct=MemoryContextAlloc(estate_mcxt,sizeof(estate_mod_data));
15961619
emd_struct->estate_not_modified= true;
1620+
#ifPG_VERSION_NUM >=160000
1621+
emd_struct->perminfo_not_modified= true;
1622+
#endif
15971623
#ifPG_VERSION_NUM >=140000
15981624
/*
15991625
* Reworked in commit a04daa97a433: field "es_num_result_relations"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp