postgresqlpostgresql-9.6

postgres 9.6 show default_tablespace


I have a tablespace on my bdd tbs1 but I want to know what is the default tablespace. My problem is that the command to show the default table space doesn't return anything :

postgres=# show default_tablespace ;
 default_tablespace
--------------------

(1 row)

postgres=#

And when I try to show all the tablespaces :

postgres=# \db+
                                                  List of tablespaces
    Name    |  Owner   |                Location                 | Access privileges | Options |   Size   | Description
------------+----------+-----------------------------------------+-------------------+---------+----------+-------------
pg_default | postgres |                                         |                   |         | 326 MB   |
pg_global  | postgres |                                         |                   |         | 1241 kB  |
tbs1    | fdu      | ... |                   |         | 553 MB |
(3 rows)

If the show default_tablespace command doens't return anything, does this means the default tablespace is pg_default ?

thanks


Solution

  • Yes, by default pg_default is the default tablespace.

    You can change the default with the default_tablespace parameter or by changing the tablespace of the database you are connected to.

    Mind that in 99% of all PostgreSQL installations you don't need to define tablespaces.