Re: Add sanity check for duplicate enum values in GUC definitions

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
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:22:13
Message-ID: A68F4A0E-1634-469B-8132-60F1AC14D72A@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Dec 17, 2025, at 22:51, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 15.12.25 10:16, 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.
>
> Why do you assign explicit values at all?

Hi Peter,

Did you mean to say “duplicate” instead of “explicit”?

Duplicate values assigning to different enum items was a copy-paste mistake I made during development, which wasted my time on debugging the issue. So I wanted to add this sanity check to quickly report such mistake in the first place.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-12-18 00:25:00 Re: [WIP]Vertical Clustered Index (columnar store extension) - take2
Previous Message Andres Freund 2025-12-18 00:19:38 Re: [PATCH] Expose checkpoint reason to completion log messages.