Em seg., 9 de fev. de 2026 às 14:42, Matheus Alcantara < [email protected]> escreveu:
> So here is V2 with some documentation changes and also with the index > name not being preserved issue that Marcos have mentioned earlier fixed. You followed INCLUDING and EXCLUDING as CREATE TABLE LIKE does, but the problem is that on command CREATE TABLE LIKE if you EXCLUDE any of available options, which are: COMMENTS | COMPRESSION | CONSTRAINTS | DEFAULTS | GENERATED | IDENTITY | INDEXES | STATISTICS | STORAGE, the table will be created anyway, because none of them are obligatory Now you are creating several objects and some of them are dependent, what do you do if a table depends on a TYPE or a DOMAIN but they were not included on the options list ? And more, a different TYPE or DOMAIN with that name exists but on another schema that is in the search_path ? I think only CREATE TABLE LIKE like you did will not work as expected. Imagine something like this. set search_path to public; create domain i32 integer check (value > 0); create schema a; create table a.t1(id i32); --create schema like should get an exception because a table cannot be created without the domains it depends. create schema b like a excluding domain; --then a second problem set search_path to a; --create a second domain but same name. table a continues using public.i32. create domain i32 integer check (value = 1); --now we have two different domains, which on will be used ? --create schema like would get an error because domain was not found on search_path or would create a table using a wrong object ? create schema b like a including all; regards Marcos
