Postgres 13.2 database contains schema named company2 which contains tables and indexes and is located in g:\Program Files\Postgresql\13\data directory.
Server has also drive I:
How to move tables and indexes from company2 schema to I: drive ?
Using
PostgreSQL 13.2, compiled by Visual C++ build 1914, 64-bit
on windows server.
You'll have to run some dynamic sql
executein a pl/pgsql loop over system catalogs to issuealter...set tablespacefor everything inside, individually. For example, tables are inpg_tables: demo at db<>fiddleForeign data wrappers allow bulk import of schemas with everything in them, privilege system allows bulk grant/revoke for entire schemas and everything in them, drop can cascade to everything in a schema. By extension, it's sort of reasonable to expect a bulk tablespace switch operation - unfortunately, there isn't one.