pg_castalog.pg_tables does not show the real tablespace for tables
От | J. Carlos Muro |
---|---|
Тема | pg_castalog.pg_tables does not show the real tablespace for tables |
Дата | |
Msg-id | 992cea4f0904070423i6e9ff45eybe5a11efe39c4dbb@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: pg_castalog.pg_tables does not show the real tablespace for tables
|
Список | pgsql-admin |
Hi!
I have created a tablespace and a database in that tablespace:
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:
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:
Is there a way to see where real tablespace for a given table?
Thanks in advance!!
J. Carlos Muro
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);
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 |
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
------------+----------+----------+------------+---------------------------
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 по дате отправления: