Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PG_FUNCTION_INFO_V1 did quite well for Postgres over the years.
However, it has issues:
The safety of our extensions often relies on being defensive about the types of arguments the functions receive. A Postgres user with sufficient privileges can create a function with any parameters/return signature calling our native function. Unless that function inspects FunctionCallInfo deeply (which comes at a non-zero cost), all bets are off in this case, and a crash or other malfunction can occur.
Sometimes, it would be meaningful to select a different function implementation based on some load-time parameters – either based on the host system or on something coming from the database. In the case of more optimal generated code specific to CPUs, function multiversioning can alleviate this (subject to limitations of multiversioning, but for all other cases, there's no straightforward way to pick the right function when we load it.
PG_FUNCTION_INFO_V2
definespg_finfo_FUNCTION_NAME
symbol. Some languages make it much harder to construct names like this. This also makes it much harder to list all exported names (we need to find symbols!)This is less critical than the ones above, but it is still a concern.
Linked discussion: https://github.com/orgs/pgedc/discussions/38
This change introduces a way to list all functions ahead of time, with their parameters.