Citus Fix json_build_object with tables with more than 50 columns #10229
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.
Postgres has by default a limitation for functions names max_function_args and is set to 100, which means you can't pass more that 100 arguments to a pg function otherwise it throws error
BTW I'm talking about postgres with Citus, seems that in postgres implementation you guys use row_json which is fine and that;s why there it doesn't happen
The implementation in hasura is that for every table column it adds 2 arguments in json_build_object object one lets say "a" and another "root.a"
WHICH means that with hasura this limitation becomes 50 column maximum per table, which is not really friendly
To change max_function_args in Postgres you just have to recompile Postgres, which is something I would not sugest to someone to do) even Postgres team doesn't sugest to compile your own version
SInce postgres way is not a solution It needs to be fixed in Hasura definitelly because Postgres limitation is good 100 but because of how hasura adds args it just becomes 50 which is already a problem for most apps, I have a small table where I keep app config, and is normal that a config would have more that 50 columns but hasura doesn't allow to query this table at all because of this limitation
PS. I just opened this PR because I see there are 2k issues and the chance that the issue will be read soon is zero
But I consider this a serious limitation
SInce I do not know haskel I cant contribute so I would love some help from Hasura team to implement this
I think this fix for them would take not much time since they know haskel and the fix most probably is already described here
https://postgrespro.com/list/thread-id/2486891