Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement - Mailing list pgsql-hackers

From jian he
Subject Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement
Date
Msg-id CACJufxHCB1AbtkyLV1WVPmTc2sMvSc_EvTvYcOL_waCUkd4FaA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement  (Tim Waizenegger <tim.waizenegger@enterprisedb.com>)
List pgsql-hackers
On Wed, Oct 22, 2025 at 5:32 PM Tim Waizenegger
<tim.waizenegger@enterprisedb.com> wrote:
>
> updated patch is attached
>

I’ve done some refactoring, hope it’s now more intuitive to you.
Since a domain’s base type can itself be another domain, it’s better to use

    appendStringInfo(&buf, "CREATE DOMAIN %s AS %s",
                     generate_qualified_type_name(domain_oid),
                     generate_qualified_type_name(typForm->typbasetype));

then the domain's base type is also fully qualified.

I also refactored the logic for printing domain constraints, which should reduce
syscache lookups or table scans compared to your version.

please check the attached.

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH] Free memory allocated by waitonlock_error_callback()
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Free memory allocated by waitonlock_error_callback()