may be a mismatch between the construct_array and construct_md_array comments
While working on the "POC, WIP: OR-clause support for indexes" project
[0]: https://commitfest.postgresql.org/49/4450/
one-dimensional array.
I noticed that there is a comment that values with NULL are not
processed there, but in fact this function calls the construct_md_array
function, which
contains a comment that it can handle NULL values.
/*
* construct_array --- simple method for constructing an array object
*
* elems: array of Datum items to become the array contents
* (NULL element values are not supported).
*/
/*
* construct_md_array --- simple method for constructing an array object
* with arbitrary dimensions and possible NULLs
*/
In the places where the construct_md_array function is called, I did not
see a check for NULL and a limitation on the use of the function, if any.
The tests during the check did not show that there is a problem with
this [1]/messages/by-id/CACJufxHCJvC3X8nUK-jRvRru-ZEXp16EBPADOwTGaqmOYM1Raw@mail.gmail.com.
Is this comment correct or we should update it?
[0]: https://commitfest.postgresql.org/49/4450/
[1]: /messages/by-id/CACJufxHCJvC3X8nUK-jRvRru-ZEXp16EBPADOwTGaqmOYM1Raw@mail.gmail.com
/messages/by-id/CACJufxHCJvC3X8nUK-jRvRru-ZEXp16EBPADOwTGaqmOYM1Raw@mail.gmail.com
Alena Rybakina <a.rybakina@postgrespro.ru> writes:
I noticed that there is a comment that values with NULL are not
processed there, but in fact this function calls the construct_md_array
function, which
contains a comment that it can handle NULL values.
Right. construct_md_array has a "bool *nulls" argument, but
construct_array doesn't --- it passes NULL for that to
construct_md_array, which will therefore assume there are no null
array elements.
regards, tom lane
On 12.09.2024 20:44, Tom Lane wrote:
Alena Rybakina <a.rybakina@postgrespro.ru> writes:
I noticed that there is a comment that values with NULL are not
processed there, but in fact this function calls the construct_md_array
function, which
contains a comment that it can handle NULL values.Right. construct_md_array has a "bool *nulls" argument, but
construct_array doesn't --- it passes NULL for that to
construct_md_array, which will therefore assume there are no null
array elements.
Understood.
At first I thought this comment was related to the value of a NULL
element that might be in the Array, but now I realized that this is not
the case.
Thanks for the explanation, it helped a lot!