> the need for this code seems not that great. But as to the code itself I'm unable to properly judge.
A simplified version of my use case is like this:
CREATE FOREIGN TABLE ft(rawdata json);
INSERT INTO tbl SELECT (convert_func(rawdata)).* FROM ft;
We have a foreign data source that can emit json data in different
formats. We need different
convert_func to extract the actual fields out. The client know which
function to use, but as
the each json may have hundreds of columns, the performance is very poor.
Best regards,
Peifeng Qiu