Re: Some optimizations for COALESCE expressions during constant folding

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Some optimizations for COALESCE expressions during constant folding
Date: 2025-12-01 08:11:25
Message-ID: CAMbWs49VoRxj3Gm=Wqt1EdEDz6OGgOuVqvAxhKGcUUv2PwE-vA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Attached is the patch set rebased on current master. I have split the
patch into two parts: 0001 teaches eval_const_expressions to simplify
COALESCE arguments using NOT NULL constraints, and 0002 teaches
expr_is_nonnullable to handle COALESCE expressions.

In addition, 0003 is a WIP patch that extends expr_is_nonnullable to
handle more expression types. I suspect there are additional cases
beyond those covered in this patch that can be proven non-nullable.

- Richard

Attachment Content-Type Size
v3-0001-Simplify-COALESCE-arguments-using-NOT-NULL-constr.patch application/octet-stream 7.5 KB
v3-0002-Teach-expr_is_nonnullable-to-handle-CoalesceExprs.patch application/octet-stream 6.2 KB
v3-0003-Teach-expr_is_nonnullable-to-handle-more-expressi.patch application/octet-stream 3.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2025-12-01 08:15:49 Re: [PATCH] Expose checkpoint timestamp and duration in pg_stat_checkpointer
Previous Message Peter Eisentraut 2025-12-01 07:55:50 missing PG_IO_ALIGN_SIZE uses