I am trying to add partitioning to a table in my database. Here is an example:
CREATE TABLE IF NOT EXISTS myBd.test_table
(
id SERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL,
age INT NOT NULL
) PARTITION BY hash (id);
However, I get the following error:
ERROR: cannot specify default tablespace for partitioned relations
I understand that the default tablespace has been changed by the database administrators. After running the command:
SELECT datname, dattablespace
FROM pg_database
WHERE datname = 'myDb';
I get:
dattablespace = 16000
What can I do to create a partitioned table? I do not have permissions to change the default tablespace.
Thank you!
2
Answers
The issue was resolved with the command
The documentation says
It provides an example for the tablespace being explicitly specified as we can see:
So, if you are not allowed to specify the default
tablespace
and you have no access right to it, then make sure you have access to atablespace
and specify it as yourtablespace
.