On 06/02/26 11:35, Jim Jones wrote:
I'd like to propose the introduction of the LIKE syntax on CREATE SCHEMA command with the following syntax: CREATE SCHEMA <name> LIKE <source_schema> [like_options...]Where like_options is: { INCLUDING | EXCLUDING } { TABLE | INDEX | ... | ALL } The idea of LIKE syntax is to create a new schema with all objects that exist on source schema like tables, indexes, sequences, functions, views, etc.I generally like the idea. One quick note: I'm just wondering if using a similar syntax as IMPORT FOREIGN SCHEMA would be better than creating a new one IMPORT FOREIGN SCHEMA remote_schema [ { LIMIT TO | EXCEPT } ( table_name [, ...] ) ] FROM SERVER server_name INTO local_schema [ OPTIONS ( option 'value' [, ... ] ) ] So EXCEPT instead of EXCLUDING and LIMIT TO instead of INCLUDING. Of course, assuming the proposed syntax isn't already defined in the SQL standard.
Yeah, it could be an option but IMHO adding the LIKE on CREATE SCHEMA sounds more similar to what we already have for CREATE TABLE ... LIKE.
Although I prefer the CREATE SCHEMA LIKE syntax I'm open to discuss about other syntaxes.
-- Matheus Alcantara EDB: https://www.enterprisedb.com
