Cleaning up array_ref() and array_set()

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Cleaning up array_ref() and array_set()
Date: 2026-02-24 10:43:15
Message-ID: 5bb669cc-7c48-4a50-b0b6-0612f95426d1@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

We have array_ref() and array_set() which are merely wrappers around
array_get_element() and array_set_element(). The wrappers take an
ArrayType * argument while array_{get|set}_element() take a Datum as
argument; like most of the other array functions.

array_ref() and array_set() are relicts from the following commit from 2015:

commit e983c4d1aa42d613542cf222e222b034918374b1
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Date: Mon Feb 16 12:23:58 2015 -0500

...
However, there's a fair amount of code using array_ref and array_set
with arrays that *are* known to be ArrayType structures, and there might
be more such places in third-party code.

This has changed over the years. On master there are only 5 calls to
array_ref() and 5 calls to array_set() left. Are there any objections
against cleaning up the code by removing array_ref() and array_set()?

--
David Geier

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-02-24 10:50:35 Re: remove unnecessary include in src/backend/commands/policy.c
Previous Message Andrew Dunstan 2026-02-24 10:40:06 Re: Non-text mode for pg_dumpall