Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3A828B5DBD6 for ; Sat, 18 Jun 2011 02:02:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 68025-05 for ; Sat, 18 Jun 2011 05:02:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id 4DB40B5DBDD for ; Sat, 18 Jun 2011 02:02:08 -0300 (ADT) Received: from [192.168.1.7] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0MN4u0-1QRBxu22o4-006fkH; Sat, 18 Jun 2011 07:02:07 +0200 Message-ID: <4DFC3148.6040906@2ndQuadrant.com> Date: Sat, 18 Jun 2011 01:02:00 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110505 Icedove/3.0.11 MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: how to find a tablespace for the table? References: <1308351052419-4500200.post@n5.nabble.com> In-Reply-To: <1308351052419-4500200.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:7etNoETeef4uxZbUjDQ0Ws0e7bup4kSLw3wGiSgebD3 Tc0GFRSDtw/FiFa5fWks6gt84SOS2uwMO5A9Rl193aXuGvnwAD 6gTSApAIK8vMVyuZ7+vukuSfs/6mmUU3TkLhv0FkaFpBuQ5AeV biUYx2i5hz/YomEYZGiC1IBfgCh77Ub20KsELR0dk7aLyfXWue Wxy5x1Hp/p8v/q5sHa1TQaibdYlVTXzQcSUJnB48Ig= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201106/524 X-Sequence-Number: 176957 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