From: Greg Smith <greg@2ndQuadrant.com>
To: pgsql-general@postgresql.org
Subject: Re: how to find a tablespace for the table?
Date: Sat, 18 Jun 2011 01:02:00 -0400
Message-ID: <4DFC3148.6040906@2ndQuadrant.com> (raw)
In-Reply-To: <1308351052419-4500200.post@n5.nabble.com>
References: <1308351052419-4500200.post@n5.nabble.com>
On 06/17/2011 06:50 PM, hyelluas wrote:
> I'm looking into pg_tables view and only one tablespace is displayed is
> pg_global.
> All my tables are created in my custom tablespace and that column is empty
> for them.
>
I'm not sure what's wrong here, but the query you are trying to use to
decode this information doesn't look quite right. pg_tables is just a
regular query; here is its source code:
CREATE VIEW pg_tables AS
SELECT
N.nspname AS schemaname,
C.relname AS tablename,
pg_get_userbyid(C.relowner) AS tableowner,
T.spcname AS tablespace,
C.relhasindex AS hasindexes,
C.relhasrules AS hasrules,
C.relhastriggers AS hastriggers
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
LEFT JOIN pg_tablespace T ON (T.oid = C.reltablespace)
WHERE C.relkind = 'r';
I think that if you start with this and try to experiment from there,
you may be able to figure out what's going on here a little better.
This connects up the main relevant tables in the right way.
--
Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: greg@2ndQuadrant.com
Subject: Re: how to find a tablespace for the table?
In-Reply-To: <4DFC3148.6040906@2ndQuadrant.com>
References: <1308351052419-4500200.post@n5.nabble.com> <4DFC3148.6040906@2ndQuadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox