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

[PGPRO-13804] Save original RTEPermissionInfo array before adding a new element#284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
kovdb75 wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
fromPGPRO-13804
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletionssrc/partition_filter.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,6 +51,9 @@ typedef struct
{
intestate_alloc_result_rels;/* number of allocated result rels */
boolestate_not_modified;/* did we modify EState somehow? */
#if PG_VERSION_NUM >= 160000
boolperminfo_not_modified;/* did we change the estate->es_rteperminfos field? */
#endif
} estate_mod_data;

/*
Expand DownExpand Up@@ -95,6 +98,9 @@ static Node *fix_returning_list_mutator(Node *node, void *state);

static Index append_rte_to_estate(EState *estate, RangeTblEntry *rte, Relation child_rel);
static int append_rri_to_estate(EState *estate, ResultRelInfo *rri);
#if PG_VERSION_NUM >= 160000
static void prepare_estate_for_append_perminfo(EState *estate);
#endif

static void pf_memcxt_callback(void *arg);
static estate_mod_data * fetch_estate_mod_data(EState *estate);
Expand DownExpand Up@@ -337,6 +343,7 @@ scan_result_parts_storage(EState *estate, ResultPartsStorage *parts_storage,
parent_perminfo = getRTEPermissionInfo(estate->es_rteperminfos, init_rte);

child_rte->perminfoindex = 0;/* expected by addRTEPermissionInfo() */
prepare_estate_for_append_perminfo(estate);
child_perminfo = addRTEPermissionInfo(&estate->es_rteperminfos, child_rte);
child_perminfo->requiredPerms= parent_perminfo->requiredPerms;
child_perminfo->checkAsUser= parent_perminfo->checkAsUser;
Expand DownExpand Up@@ -1449,6 +1456,22 @@ fix_returning_list_mutator(Node *node, void *state)
* -------------------------------------
*/

#if PG_VERSION_NUM >= 160000
/* Prepare estate->es_rteperminfos for append RTEPermissionInfo */
static void
prepare_estate_for_append_perminfo(EState *estate)
{
estate_mod_data *emd_struct = fetch_estate_mod_data(estate);

/* Copy estate->es_rteperminfos if it's first time expansion. */
if (emd_struct->perminfo_not_modified)
estate->es_rteperminfos = list_copy(estate->es_rteperminfos);

/* Update estate_mod_data. */
emd_struct->perminfo_not_modified = false;
}
#endif

/* Append RangeTblEntry 'rte' to estate->es_range_table */
static Index
append_rte_to_estate(EState *estate, RangeTblEntry *rte, Relation child_rel)
Expand DownExpand Up@@ -1594,6 +1617,9 @@ fetch_estate_mod_data(EState *estate)
/* Have to create a new one */
emd_struct = MemoryContextAlloc(estate_mcxt, sizeof(estate_mod_data));
emd_struct->estate_not_modified = true;
#if PG_VERSION_NUM >= 160000
emd_struct->perminfo_not_modified = true;
#endif
#if PG_VERSION_NUM >= 140000
/*
* Reworked in commit a04daa97a433: field "es_num_result_relations"
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp