Re: Why is the index not created in the tablespace delivered in the create-index-command ? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Why is the index not created in the tablespace delivered in the create-index-command ?
Date
Msg-id 11927.1097512535@sss.pgh.pa.us
Whole thread Raw
In response to Why is the index not created in the tablespace delivered in the create-index-command ?  (Michael Kleiser <mkl@webde-ag.de>)
List pgsql-bugs
Michael Kleiser <mkl@webde-ag.de> writes:
> test1=>  select * from pg_indexes  where tablename='foobar';
>   schemaname | tablename | tablespace | indexname |                                indexdef
>
------------+-----------+------------+-----------+-------------------------------------------------------------------------
>   public     | foobar    | ts_test_1  | ix_foobar | CREATE INDEX ix_foobar ON foobar USING btree (foo) TABLESPACE
ts_test_2
> (1 row)

> Why is index "ix_foobar" in tablespace "ts_test_1" and not in tablespace "ts_test_2" ?
> Is it a bug ?

The index is in fact in the right tablespace, as you can verify by
checking its pg_class entry.  The problem is that the pg_indexes view is
showing you the table's tablespace and not the index's.  I think this is
clearly wrong, or at least not what one would find most useful.

Since we've already decided to force an initdb for beta4, there doesn't
seem to be any downside to fixing this now.  I'm going to change the
view to show the index tablespace instead of the table's, and I think
also move the tablespace one column to the right --- it seems bizarre
to place it before the index name.

Thanks for the report!

            regards, tom lane

pgsql-bugs by date:

Previous
From: Michael Kleiser
Date:
Subject: Why is the index not created in the tablespace delivered in the create-index-command ?
Next
From: Andre Maasikas
Date:
Subject: Re: Unable to dump database/table