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

From: Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)com>
To: Florin Irion <irionr(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement
Date: 2025-11-20 09:44:07
Message-ID: CAA3qoJkyF2_jcCQ9ghk-Zps7bsfeBCcV0dYi1prqTZ=i26Yw6w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Florin,

+pg_get_domain_ddl_ext(PG_FUNCTION_ARGS)
> +{
> + Oid domain_oid = PG_GETARG_OID(0);
> + bool pretty = PG_GETARG_BOOL(1);
> + char *res;
> + int prettyFlags;
> +
> + prettyFlags = pretty ? GET_PRETTY_FLAGS(pretty) : 0;

Seems like we should directly use GET_PRETTY_FLAGS here, as it already
checks the value of "pretty". For a "display-oriented" result, using
PRETTYFLAG_INDENT looks more appropriate.

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

It might be good to first call get_typtype to check if it is TYPTYPE_DOMAIN.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-11-20 09:50:26 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Previous Message Daniel Gustafsson 2025-11-20 09:38:49 Re: 10% drop in code line count in PG 17