pg_castalog.pg_tables does not show the real tablespace for tables - Mailing list pgsql-admin

From J. Carlos Muro
Subject pg_castalog.pg_tables does not show the real tablespace for tables
Date
Msg-id 992cea4f0904070423i6e9ff45eybe5a11efe39c4dbb@mail.gmail.com
Whole thread Raw
Responses Re: pg_castalog.pg_tables does not show the real tablespace for tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
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

pgsql-admin by date:

Previous
From: Emanuel Calvo Franco
Date:
Subject: Re: COPY-ing ASCII file into UTF-8 database
Next
From: Tom Lane
Date:
Subject: Re: pg_castalog.pg_tables does not show the real tablespace for tables