| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add sanity check for duplicate enum values in GUC definitions |
| Date: | 2025-12-18 00:36:23 |
| Message-ID: | F5F519D0-B6C9-4157-913F-4459F8F7DF9B@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Dec 17, 2025, at 23:19, Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> On 2025-12-15 17:16:56 +0800, Chao Li wrote:
>> The motivation for this patch comes from my own experience. While working
>> on [1]. I added an enum-typed GUC and made a copy-and-paste mistake,
>> assigning the same numeric value to two different enum entries. This
>> resulted in confusing runtime behavior and cost me about an hour to track
>> down.
>
> I think this is something we explicitly do *not* want. It can make plenty
> sense to have enums with the same value assigned multiple times. And ending up
> with a list of exceptions doesn't strike me as a good use of time.
There is actually only one enum (“wal_compression”) having duplicate values if excluding hidden items. In my patch, hidden items have been ignored, so the white-list has only one entry.
>
> I just dont' believe this is a frequent enough issue to be worth in-core
> infrastructure, particularly in light of it sometimes being actually
> intentionally used.
>
I think copy-paste mistake is easy to make. I have done an enhancement for GUC, see [1], that also helps debugging against such errors. In the discussion, you can see that Alvaro echoed that he made the same mistake.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-18 00:54:54 | Re: Add sanity check for duplicate enum values in GUC definitions |
| Previous Message | Melanie Plageman | 2025-12-18 00:35:53 | Re: Adding vacuum test case of setting the VM when heap page is unmodified |