PostgreSQL already comes with plenty of system information functions to reconstruct the commands to create various objects, e.g. constraints or indexes. Starting with PostgreSQL 19 more functions will be available, namely those: pg_get_database_ddl pg_get_role_ddl pg_get_tablespace_ddl(…)