Hi!
I have created a tablespace and a database in that tablespace:
create tablespace tb_user location '/data/tb_user';
create database mydatabase tablespace "tb_user";
\c mydatabase;
create table a_table (id bigint, name text);
I supposed that "a_table" should be in the tablespace "tb_user" as the
database was created to use it by default. But I doesnt seem like that when
i state the next:
mydatabase=# select tablename,tablespace from pg_catalog.pg_tables where
tablename='a_table';
tablename | tablespace
-----------+------------
a_table |
Why?
I can imagine that the table was really created in tb_user tablespace, as i
realize that there were created new files under the /data/tb_user directory.
The database seems to have been properly created for that tablespace:
Name | Owner | Encoding | Tablespace | Description
------------+----------+----------+------------+---------------------------
mydatabase | postgres | UTF8 | tb_user |
postgres | postgres | UTF8 | pg_default |
template0 | postgres | UTF8 | pg_default |
template1 | postgres | UTF8 | pg_default | default template database
Is there a way to see where real tablespace for a given table?
Thanks in advance!!
J. Carlos Muro