may be a mismatch between the construct_array and construct_md_array comments

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: may be a mismatch between the construct_array and construct_md_array comments
Date: 2024-09-12 15:43:12
Message-ID: 87340765-db13-4689-92b9-699a2dbb4aba@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While working on the "POC, WIP: OR-clause support for indexes" project
[0], it was suggested to use the construct_array function to form a
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].

Is this comment correct or we should update it?

[0] https://commitfest.postgresql.org/49/4450/

[1]
https://www.postgresql.org/message-id/CACJufxHCJvC3X8nUK-jRvRru-ZEXp16EBPADOwTGaqmOYM1Raw%40mail.gmail.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2024-09-12 15:46:55 Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges
Previous Message Tomas Vondra 2024-09-12 14:57:18 Re: Incremental Sort Cost Estimation Instability