Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Tim Waizenegger <tim(dot)waizenegger(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement
Date: 2025-10-23 04:21:34
Message-ID: CACJufxHCB1AbtkyLV1WVPmTc2sMvSc_EvTvYcOL_waCUkd4FaA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 22, 2025 at 5:32 PM Tim Waizenegger
<tim(dot)waizenegger(at)enterprisedb(dot)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 Content-Type Size
v2-0001-refactor-pg_get_domain_ddl.no-cfbot application/octet-stream 25.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-10-23 04:29:35 Re: [PATCH] Free memory allocated by waitonlock_error_callback()
Previous Message Michael Paquier 2025-10-23 04:08:22 Re: [PATCH] Free memory allocated by waitonlock_error_callback()