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

From Chao Li
Subject Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement
Date
Msg-id 36A72FEF-F07E-40A8-8022-998D5DA6FD04@gmail.com
Whole thread Raw
In response to Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement  (Florin Irion <irionr@gmail.com>)
List pgsql-hackers

> On Nov 12, 2025, at 00:14, Florin Irion <irionr@gmail.com> wrote:
>
> Hello, Cirrus-CI was complaining because we don't sort the constraints and thus
> they were making the test fail because of the random order.
> Made it sort with `list_sort`and `list_oid_cmp`not sure if that's the best
> thing to sort them.
> Check v4 attached.
> Cheers,
> Florin Irion
> Tim Waizenegger
> EDB (EnterpriseDB)
> <v4-0001-Add-pg_get_domain_ddl-function-to-reconstruct-CRE.patch>

I just tested v4, and see two problems:

```
evantest=# CREATE DOMAIN public.int AS pg_catalog.int4;
CREATE DOMAIN
evantest=# SELECT pg_get_domain_ddl('int');
ERROR:  cache lookup failed for type 0
evantest=#
evantest=#
evantest=# SELECT pg_get_domain_ddl('pg_class');
ERROR:  cache lookup failed for type 0
evantest=#
evantest=#
evantest=# SELECT pg_get_domain_ddl('public.int');
               pg_get_domain_ddl
------------------------------------------------
 CREATE DOMAIN public."int" AS pg_catalog.int4;
(1 row)

evantest=# show search_path;
   search_path
-----------------
 "$user", public
(1 row)
```

1. The error message "cache lookup failed for type 0” looks not good. At lease saying something like “domain ‘int’ does
notexist”. 

2. I created a domain “int” in “public”, as you see, “public” is in the search_path, but SELECT
pg_get_domain_ddl('int’);failed. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: "Vitaly Davydov"
Date:
Subject: RE: Newly created replication slot may be invalidated by checkpoint
Next
From: Dean Rasheed
Date:
Subject: Re: ON CONFLICT DO SELECT (take 3)