how to find a tablespace for the table?

From: Daulat Ram <Daulat(dot)Ram(at)exponential(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: how to find a tablespace for the table?
Date: 2020-02-22 18:34:19
Message-ID: MN2PR01MB585454502962534049DD06C89BEE0@MN2PR01MB5854.prod.exchangelabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi team,
how to find a tablespace for the table?
See my comments below:
I have created a database with default tablespace like below:

edb=# CREATE DATABASE conndb WITH TABLESPACE = conn_s_tables;

After that I have created a table

CREATE TABLE COMPANY_new(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL,
JOIN_DATE DATE
) ,

CREATE TABLE COMPANY_new(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL,
JOIN_DATE DATE
)
tablespace conn_s_tables ;

But I am unable to search the tablespace name where tablespace exist , tablespace column is blank.

conndb=# select schemaname,tablename,tableowner,tablespace from pg_tables where tablename='company';
schemaname | tablename | tableowner | tablespace
------------+-----------+--------------+------------
conndb | company | enterprisedb |
(1 row)

conndb=# select schemaname,tablename,tableowner,tablespace from pg_tables where tablename='company_new';
schemaname | tablename | tableowner | tablespace
------------+-------------+--------------+------------
conndb | company_new | enterprisedb |

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-02-22 18:45:39 Re: how to find a tablespace for the table?
Previous Message Edson Richter 2020-02-22 18:05:14 RE: Replication: slave server has 3x size of production server?