Re: Standardize the definition of the subtype field of AlterDomainStmt

From: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
To:
Cc: 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-27 09:44:41
Message-ID: CAGjGUAK5vhoAe_XsHjsvJfsXG0Bvey5QS4cZR9M-fVBC9fw1xA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

HI
> 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.
Agree ,This makes the code neater and easier to understand

On Tue, May 27, 2025 at 11:55 AM Michael Paquier <michael(at)paquier(dot)xyz>
wrote:

> On Tue, May 27, 2025 at 11:06:46AM +0800, 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.
>
> Sounds like a good idea. As far as I can see after a closer lookup at
> the tree, you have updated all the code paths that matter for this
> change, and you have added a CF entry:
> https://commitfest.postgresql.org/patch/5780/
>
> +#define AD_VaidateConstraint 'V' /* VALIDATE CONSTRAINT */
>
> s/Vaidate/Validate
> --
> Michael
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Kumar Veldanda 2025-05-27 10:11:22 Re: ZStandard (with dictionaries) compression support for TOAST compression
Previous Message Reda Agaoua 2025-05-27 09:43:11 Suggestion : support for environment variable in initdb to set the superuser password