Re: [PATCH] Do not use StdRdOptions in Access Methods - Mailing list pgsql-hackers

From Amit Langote
Subject Re: [PATCH] Do not use StdRdOptions in Access Methods
Date
Msg-id CA+HiwqF5Mx55bGkpQPzdre9FvSsHFSF8OHDyvDc+gCArsGhBOg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Do not use StdRdOptions in Access Methods  (Nikolay Shaplov <dhyan@nataraj.su>)
Responses Re: [PATCH] Do not use StdRdOptions in Access Methods  (Nikolay Shaplov <dhyan@nataraj.su>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: use of the term "verifier" with SCRAM
Next
From: Amit Langote
Date:
Subject: Re: dropping column prevented due to inherited index