Re: Add sanity check for duplicate enum values in GUC definitions
| От | Chao Li |
|---|---|
| Тема | Re: Add sanity check for duplicate enum values in GUC definitions |
| Дата | |
| Msg-id | F5F519D0-B6C9-4157-913F-4459F8F7DF9B@gmail.com обсуждение исходный текст |
| Ответ на | Re: Add sanity check for duplicate enum values in GUC definitions (Andres Freund <andres@anarazel.de>) |
| Список | pgsql-hackers |
> On Dec 17, 2025, at 23:19, Andres Freund <andres@anarazel.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, hiddenitems 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 againstsuch errors. In the discussion, you can see that Alvaro echoed that he made the same mistake. [1] https://www.postgresql.org/message-id/CAEoWx2%3DoP4LgHi771_OKhPPUS7B-CTqCs%3D%3DuQcNXWrwBoAm5Vg%40mail.gmail.com Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
В списке pgsql-hackers по дате отправления: