Skip to content

Commit

Permalink
Fix SEGV caused by duplicate memoize hints
Browse files Browse the repository at this point in the history
HintTypeName was missing the item for the Memoize hint. This causes
SEGV or "(null)" printing by printf on erroring of duplicate memoize
hints.

Add the missing item and a static assertion to check the same kind of
fault.

Reported by ShangBenX <https://github.com/ShangBenX>
  • Loading branch information
horiguti committed Jan 19, 2022
1 parent e6a9004 commit c23bb6a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pg_hint_plan.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,13 @@ static const char *HintTypeName[] = {
"leading",
"set",
"rows",
"parallel"
"parallel",
"memoize"
};

StaticAssertDecl(sizeof(HintTypeName) / sizeof(char *) == NUM_HINT_TYPE,
"HintTypeName and HintType don't match");

/* hint status */
typedef enum HintStatus
{
Expand Down

0 comments on commit c23bb6a

Please sign in to comment.