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.