-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to create an object with an array field of more than 100 elements #989
Comments
Probably this issue might be considered as a duplicate of #949, but we believe we have a different use case. |
@vladiksun this isn't really a bug with age rather a configurable limit of PostgreSQL. If you'd like to change it, you have to make a 1 line change in the source code of PostgreSQL and compile it manually. The line you'd have to change is line#43 of pg-srcdir/include/pg_config_manual.h, you can assign your desired higher value to the defined FUNC_MAX_ARGS in that line and this will resolve your issue. |
@maazzzzz Thanks for your advice but this is unfortunately not feasible for us because the Postgres distribution is precompiled and delivered by a dedicated vendor, so we cannot customize it. |
@vladiksun I'm sure you've already seen the workaround posted in the issue you linked above. Aside from that, i cant say with complete certainty, I'll have to look into it but I don't believe thats possible . @jrgemignani can better comment on that. Also what would be the max length of an array in your workflow? |
@maazzzzz Thank you. We expect an array to grow and shrink dynamically, depends on business logic. Could be several hundreds items. |
I have asked a similar question Stack Overflow 1- Use an array as a single argument instead of individual arguments |
@Amr-Shams thanks for your comments on this. |
There might be a way to modify the transform logic to work-around this limitation. I was able to find where in the code the issue is created and I will take a deeper look tomorrow. |
@jrgemignani thank you for taking a look at this. |
The function I will work on a PR to fix this |
@vladiksun Curious, how big is the largest list that you expect? |
@jrgemignani In our scenarios the largest is no more than 500 elements |
Fixed issue 989: Impossible to create an object with an array field of more than 100 elements. This issue is due to the function agtype_build_list taking elements as arguments. As the elements can be anything, expressions too, they need to be processed by the transform phase and resolved in the execution phase. As PG has a limitation of 100 function arguments, this restricts the size of arrays built through agtype_build_list. The fix was to break up large lists into segments of 100 items or less and then use the concatenation operator to join them in the execution phase. Added regression tests.
@vladiksun I have -
Note: there are no restrictions on the array size. The fix works by breaking large lists into lists of no greater than 100 items and then wrapping those lists and the sub results with the concatenation operator. So, it will likely incur a small performance hit on creation. The larger the list, the larger the hit. |
@jrgemignani thank you for fixing this |
Fixed issue 989: Impossible to create an object with an array field of more than 100 elements. This issue is due to the function agtype_build_list taking elements as arguments. As the elements can be anything, expressions too, they need to be processed by the transform phase and resolved in the execution phase. As PG has a limitation of 100 function arguments, this restricts the size of arrays built through agtype_build_list. The fix was to break up large lists into segments of 100 items or less and then use the concatenation operator to join them in the execution phase. Added regression tests (thanks Taha!).
Fixed issue 989: Impossible to create an object with an array field of more than 100 elements. This issue is due to the function agtype_build_list taking elements as arguments. As the elements can be anything, expressions too, they need to be processed by the transform phase and resolved in the execution phase. As PG has a limitation of 100 function arguments, this restricts the size of arrays built through agtype_build_list. The fix was to break up large lists into segments of 100 items or less and then use the concatenation operator to join them in the execution phase. Added regression tests (thanks Taha!).
@vladiksun The fix is now merged into the master branch (on postgresql version 11). We will be migrating the latest patches into the higher branches in a few weeks. But, you are welcome to use the master for your work. |
Closing this as completed. Fix in PR #1001. |
Describe the bug
Currently apache age hits the postgres limit when trying to create an object with an array field of more than 100 elements
How are you accessing AGE (Command line, driver, etc.)?
What data setup do we need to do?
What is the command that caused the error?
Expected behavior
A label properties object has to be created with an array field more than 100 elements
Environment (please complete the following information):
Additional context
Probably there is a way to bypass this limitation by using an array as a parameter.
Currently, we are in a research if we can move to apache age from another vendor.
This kind of blocks us.
The text was updated successfully, but these errors were encountered: