Skip to content
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

Fix issue 5646 #5652

Merged
merged 1 commit into from
Dec 23, 2022
Merged

Fix issue 5646 #5652

merged 1 commit into from
Dec 23, 2022

Conversation

lokax
Copy link
Contributor

@lokax lokax commented Dec 9, 2022

Fix #5646

Copy link
Collaborator

@Mytherin Mytherin left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks good. Some comments below.

$$ = (PGNode *) n;
| '{' dict_arguments_opt_comma '}' opt_indirection {
PGFuncCall *f = makeFuncCall(SystemFuncName("struct_pack"), $2, @2);
if ($4)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you fix the indentation here?

$$ = (PGNode *) n;
| '{' dict_arguments_opt_comma '}' opt_indirection {
PGFuncCall *f = makeFuncCall(SystemFuncName("struct_pack"), $2, @2);
if ($4)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be a pattern that is repeated in several places here - could we perhaps extract it into a separate node (indirect_expr), and do something like this:

c_expr:
    ...
    | indirect_expr opt_indirection
    {
        if ($2) {
            PGAIndirection *n = makeNode(PGAIndirection);
            n->arg = (PGNode *) $1;
            n->indirection = check_indirection($2, yyscanner);
            $$ = (PGNode *) n;
        }
        else {
            $$ = (PGNode *) $1;
        }
    }
| ...

indirect_expr: 
    '?'
    {
        $$ = makeParamRef(0, @1);
    }
    | PARAM
    {
        PGParamRef *p = makeNode(PGParamRef);
        p->number = $1;
        p->location = @1;
         $$ = (PGNode *) n;
    }
    | ...    

@lokax lokax requested review from Mytherin and removed request for Mytherin December 23, 2022 08:22
@Mytherin Mytherin merged commit d778a61 into duckdb:master Dec 23, 2022
@Mytherin
Copy link
Collaborator

Thanks for the fixes! LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Struct extract shorthand from literal does not work without added parenthesis
2 participants