Re: [PATCH v2] Avoid internal error for invalid interval typmods

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Feng Wu <wufengwufengwufeng(at)gmail(dot)com>
Cc: Haibo Yan <tristan(dot)yim(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH v2] Avoid internal error for invalid interval typmods
Date: 2026-07-03 05:23:31
Message-ID: CAF0whue3LO0XXEUXBC0_CkfQ3upVwku9U9X8OWfeRUYY5o2i_A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Feng,

I tested the v2 patch on PostgreSQL 20devel.
The patch applied cleanly, and I rebuilt and restarted the server successfully.

Before applying the patch, calling:
SELECT pg_catalog.interval(interval '1 day', 1539);
reported:
ERROR: unrecognized interval typmod: 1539

After applying the patch, the same DO block produced:
NOTICE: invalid interval typmod rejected
which confirms that the error is now reported as
invalid_parameter_value instead of an internal error.
I also verified that the existing interval behavior remains unchanged:
SELECT interval(0) '1 day 01:23:45.6789'; returned 1 day 01:23:46
SELECT interval(2) '1 day 01:23:45.6789'; returned 1 day 01:23:45.68

The patch worked as expected in my testing.

Regards,
solai

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-07-03 05:32:46 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Amit Langote 2026-07-03 05:19:46 Re: Batching in executor