> On Nov 1, 2025, at 06:29, Philip Alger <paalger0@gmail.com> wrote:
>
>
> <v2-0001-Add-pg_get_type_ddl-function.patch>
1
```
+ /*
+ * Look up the type tuple to allow shell types.
+ */
+ typeTup = LookupTypeName(NULL, typeStruct, NULL, false);
+ if (typeTup == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("type \"%s\" does not exist",
+ TypeNameToString(typeStruct))));
```
Here when you call LookupTypeName(), you give the last parameter “missing_ok” a value of “false”, so that it would
“ereport”inside LookupTypeName(), so your manual check of “if (typeTup == NULL)” will never be satisfied.
2
```
+{ oid => '8414', descr => 'get CREATE statement for type',
+ proname => 'pg_get_type_ddl', prorettype => 'text', proisstrict => 't',
+ proargtypes => 'text', proargnames => '{typname}',
+ prosrc => 'pg_get_type_ddl' },
```
Here you set proisstrict => ’t’. With strict mode, the function will not be executed if any of input arguments are
NULL.
So add this test seems meaningless, because the function is not executed at all.
```
+SELECT pg_get_type_ddl(NULL);
+ pg_get_type_ddl
+-----------------
+
+(1 row)
```
3. As discussed in other get_xxx_ddl() patches, does this function needs a pretty flag? I think other patches have
that.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/