Re: Proposal: ABSENT ON TRAILING NULL for JSON_ARRAY

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Matias Kenig <matias(dot)kenig(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Proposal: ABSENT ON TRAILING NULL for JSON_ARRAY
Date: 2026-11-23 09:44:05
Message-ID: 8f650e7e-f64e-4c61-89b3-183fd453d7b4@proxel.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/22/26 17:11, Matias Kenig wrote:
> Would there be interest in something like this? I'm happy to work on a patch
> if the approach and the syntax seem reasonable, and I'm open to alternative
> naming (e.g. TRIM TRAILING NULLS).

Hi,

I do not really see a value for this, if you want to store sparse data
you should pick another format where you store a list of position +
value rather than values and nulls, e.g. [[0, 1], [2, 3]] in your
example. Trimming away trailing nulls seems like an ugly hack which only
gives modest savings on sparse workloads, and a hack I would not wish to
see additional syntax in our parser for. Maybe it could be worth adding
a jsonb_array_rtrim() function, but I am skeptical against even that.

Best regards,

--
Andreas Karlsson
Percona

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rajesh Kumar Thandapani 2026-11-23 09:46:45 Re: Bug in logical decoding with DDL and subtransactions
Previous Message Dean Rasheed 2026-11-23 09:29:39 Re: MERGE fails to reject source references in NOT MATCHED BY SOURCE actions