Skip to content

fix initialization of pgspHashKey structure #40

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
6 changes: 4 additions & 2 deletions pg_store_plans.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ _PG_init(void)

EmitWarningsOnPlaceholders("pg_store_plans");

#if PG_VERSION_NUM < 150000
#if PG_VERSION_NUM < 150000
pgsp_shmem_request();
#endif

Expand Down Expand Up @@ -1216,6 +1216,8 @@ pgsp_store(char *plan, queryid_t queryId,

Assert(plan != NULL && queryId != PGSP_NO_QUERYID);

memset(&key, 0, sizeof(pgspHashKey));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ifdef'd for pg11+ as until pg10 it was still a uint32, since the rest of the code correctly handle the version change.


/* Safety check... */
if (!shared_state || !hash_table)
return;
Expand Down Expand Up @@ -1292,7 +1294,7 @@ pgsp_store(char *plan, queryid_t queryId,
/* shorten_plan is terminated by NUL */
if (plan_storage == PLAN_STORAGE_SHMEM)
memcpy(SHMEM_PLAN_PTR(entry), shorten_plan, plan_len + 1);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you could just remove this line as there is another newline just after.


/* If needed, perform garbage collection while exclusive lock held */
if (do_gc)
Expand Down