Create tablespace in postgresql and set is to it is the default for all newly created databases

StackOverflow https://stackoverflow.com/questions/18004346

문제

I have created a tablespace named hdd_tablespace and I wan't all new databases to be automatically created there. Basically when I execute:

CREATE DATABASE FOO; 

I want this database to be created in hdd_tablespace.

I have updated postgresql.conf with:

 default_tablespace = 'hdd_tablespace' 

However, new databases are still created in pg_default.

도움이 되었습니까?

해결책

Actually it turned out I had also to update template1 database that is a template database.

I had to;

ALTER DATABASE template1 SET TABLESPACE hdd_tablespace; 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top