State the array arguments a function reads - #128
Merged
estebanzimanyi merged 1 commit intoSep 3, 2026
Conversation
The shape says which arrays a function ANSWERS and leaves the ones it READS to each binding to recognise, and the only thing there to recognise them by is the length parameter's name. Those names disagree across the surface — `count`, `count1`, `size`, `ngeoms`, `keys_len`, `path_len`, `pixels_size`, `wkb_size` — so a binding that knows some of them silently drops the rest, and `geo_cluster_kmeans`, `jsonb_delete_array` and their kin reach no binding at all. `shape.inputArrays` states them, the sibling of `arrayReturn` and `outputArrays`: the parameter, the parameter its length comes from, and the element type with one pointer level off. 158 arguments across the surface. The discriminator is the one this module already reads in the other direction. An output array's length is passed BY POINTER, since the callee fills it in; an input array's is passed BY VALUE, since the caller already knows it. So an input array is a parameter that is an array of pointers or of by-value scalars followed by a by-value integer — `jsonb_each`'s written-back `Jsonb **values` is not one, its `int *count` saying so. A pointer to a MEOS VALUE type beside an integer is a value and a number, never an array: `text_left(text *txt, int n)` takes one text and a character count, `jsonb_hash_extended` one jsonb and a seed, `interval_in` one string and a typmod. Only a pointer to a C scalar is an array of them, and `char *` is a string in every binding rather than an array of characters. Six tests hold the rule to those cases, the two that already stated an input array is not an output one now stating what it is instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The shape says which arrays a function ANSWERS and leaves the ones it READS to
each binding to recognise, and the only thing there to recognise them by is the
length parameter's name. Those names disagree across the surface —
count,count1,size,ngeoms,keys_len,path_len,pixels_size,wkb_size—so a binding that knows some of them silently drops the rest, and
geo_cluster_kmeans,jsonb_delete_arrayand their kin reach no binding atall.
shape.inputArraysstates them, the sibling ofarrayReturnandoutputArrays: the parameter, the parameter its length comes from, and theelement type with one pointer level off. 158 arguments across the surface.
The discriminator is the one this module already reads in the other direction.
An output array's length is passed BY POINTER, since the callee fills it in; an
input array's is passed BY VALUE, since the caller already knows it. So an
input array is a parameter that is an array of pointers or of by-value scalars
followed by a by-value integer —
jsonb_each's written-backJsonb **valuesis not one, its
int *countsaying so.A pointer to a MEOS VALUE type beside an integer is a value and a number, never
an array:
text_left(text *txt, int n)takes one text and a character count,jsonb_hash_extendedone jsonb and a seed,interval_inone string and atypmod. Only a pointer to a C scalar is an array of them, and
char *is astring in every binding rather than an array of characters.
Six tests hold the rule to those cases, the two that already stated an input
array is not an output one now stating what it is instead.