pgsql: Make geometry cast functions error safe

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make geometry cast functions error safe
Date: 2026-03-29 18:41:16
Message-ID: E1w6v4V-0021zd-1D@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make geometry cast functions error safe

This adjusts cast functions of the geometry types to support soft
errors. This requires refactoring of various helper functions to
support error contexts. Also make the float8 to float4 cast error
safe. It requires some of the same helper functions.

This is in preparation for a future feature where conversion errors in
casts can be caught.

(The function casting type circle to type polygon is not yet made error
safe, because it is an SQL language function.)

Author: jian he <jian(dot)universality(at)gmail(dot)com>
Reviewed-by: Amul Sul <sulamul(at)gmail(dot)com>
Reviewed-by: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/45cdaf3665bedfbabb908bb84284f3db26781ad3

Modified Files
--------------
src/backend/utils/adt/float.c | 28 ++++-
src/backend/utils/adt/geo_ops.c | 261 +++++++++++++++++++++++++++++-----------
src/include/utils/float.h | 49 ++++++--
3 files changed, 254 insertions(+), 84 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2026-03-30 01:13:03 pgsql: Add comment explaining fire_triggers=false in ri_PerformCheck()
Previous Message Tom Lane 2026-03-29 18:06:59 pgsql: Doc: document more incompatible pg_restore option pairs.