Hello Nikolay,

I read comments that Tomas left at:
https://www.postgresql.org/message-id/20190727173841.7ypzo4xuzizvijge%40development

I'd like to join Michael in reiterating one point from Tomas' review.
I think the patch can go further in trying to make the code in this
area more maintainable.

For example, even without this patch, the following stanza is repeated
in many places:

    options = parseRelOptions(reloptions, validate, foo_relopt_kind,
&numoptions);
    rdopts = allocateReloptStruct(sizeof(FooOptions), options, numoptions);
    fillRelOptions((void *) rdopts, sizeof(FooOptions), options, numoptions,
                   validate, foo_relopt_tab, lengthof(foo_relopt_tab));
    return (bytea *) rdopts;

and this patch adds few more instances as it's adding more Options structs.

I think it wouldn't be hard to encapsulate the above stanza in a new
public function in reloptions.c and call it from the various places
that now have the above code.

Thanks,
Amit


Reply via email to