Re: Standardize the definition of the subtype field of AlterDomainStmt

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Quan Zongliang <quanzongliang(at)yeah(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Standardize the definition of the subtype field of AlterDomainStmt
Date: 2025-05-28 11:22:51
Message-ID: bcae60ac-1d2f-443d-a13c-42588e55696a@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27.05.25 05:06, Quan Zongliang wrote:
> I noticed that the subtype of AlterDomainStmt is directly using
> constants in the code. It is not conducive to the maintenance and
> reading of the code. Based on the definition of AlterTableType, use
> "AD_" as the prefix. Define several macros to replace the original
> characters.
> The subtype of AlterTableCmd is defined using an enumeration. The
> subtypes of AlterDomainStmt are relatively few in number, and the
> original definition uses characters. These definitions still use
> characters and maintain the values unchanged. If some plugins or tools
> are also processing AlterDomainStmt, there will be no errors.

You can still make it an enum and assign the currently in use values to
the new symbols, like

enum AlterDomainType
{
AD_AlterDefault = 'T',
AD_DropNotNull = 'N',
...

I would prefer that.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-05-28 11:26:01 Re: Suggestion : support for environment variable in initdb to set the superuser password
Previous Message Tender Wang 2025-05-28 10:54:30 Re: Foreign key validation failure in 18beta1