> On 14 November 2017 at 22:25, Dmitry Dolgov <9erthali...@gmail.com> wrote: > But now I wonder if `resnull` is really needed in `jsonb_get_element`, > `array_get_element` and it seems to me that I can even get rid of it so
On the second thought, no, looks like I'm wrong and it should be like this. The reason is that any `fetch` function should be in form (container, internal) -> extracted value which means that we need to return an extracted value (for jsonb it's a `jsonb`, for array it's an `anyelement`). But at the same time in general case we can figure out if the result is null only inside a `fetch` function, (`jsonb_get_element` for jsonb or whatever it may be for a custom data type) because it returns Datum. So the only way to return this information is by reference through the `internal` argument. To summarize, If as you said it's not that critical, I would suggest to leave it as it is.