I have a schema with several tables (all populated) that I want to copy into another table but without data. I also want to keep all constraints and indexes of table.
What is the best way to do this?
Then edit the file (tables.sql), change the SET search_path = ...; statement to list your target schema as the first schema and remove the source schema from it.
Then run the SQL script in the target database using psql