pg_castalog.pg_tables does not show the real tablespace for tables

From: "J(dot) Carlos Muro" <murojc(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: pg_castalog.pg_tables does not show the real tablespace for tables
Date: 2009-04-07 11:23:57
Message-ID: 992cea4f0904070423i6e9ff45eybe5a11efe39c4dbb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2009-04-07 14:33:46 Re: pg_castalog.pg_tables does not show the real tablespace for tables
Previous Message Emanuel Calvo Franco 2009-04-06 13:56:42 Re: COPY-ing ASCII file into UTF-8 database