pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sudalai <sudalait2@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: Index file got removed
Date: Wed, 16 Nov 2016 04:16:38 -0700 (MST)
Message-ID: <1479294998857-5930602.post@n3.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,
 
Please look at a below sequence of SQL.

        set default_tablespace to '';
        create table test(id int primary key,  processid bigint not null ,
ruleid bigint not null );
        create index on test (ruleid );
        create index on test (processid );
        set default_tablespace to tblsp;
        alter table test alter processid type bigint, alter processid drop
not null;
 
I am creating a table test and index for that table on  default tablespace. 
Then i'm changing default_tablespace to some other tablespace.
After that altering one of the index column.
This alter operation moves the index to new default_tablespace, but index
file is missing in new tablespace.
So we can not access the table.

----
db=# select * from test;
ERROR:  could not open file "pg_tblspc/16703/PG_9.6_201608131/16385/16710":
No such file or directory

db=# \d+ test
                          Table "public.test"
  Column   |  Type   | Modifiers | Storage | Stats target | Description 
-----------+---------+-----------+---------+--------------+-------------
 id        | integer | not null  | plain   |              | 
 processid | bigint  |           | plain   |              | 
 ruleid    | bigint  | not null  | plain   |              | 
Indexes:
    "test_pkey" PRIMARY KEY, btree (id)
    "test_processid_idx" btree (processid), tablespace "tblsp"
    "test_ruleid_idx" btree (ruleid)

---

I tried it on 9.5.1 & 9.6.0, index got missed in both version.

-sudalai



-----
sudalai
--
View this message in context: http://postgresql.nabble.com/Index-file-got-removed-tp5930602.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (15+ messages)  latest in thread

Message-ID: <1479294998857-5930602.post@n3.nabble.com>
Permalink:  ../1479294998857-5930602.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1479294998857-5930602.post@n3.nabble.com

 · 

reply

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-bugs@postgresql.org
  Cc: sudalait2@gmail.com
  Subject: Re: Index file got removed
  In-Reply-To: <1479294998857-5930602.post@n3.nabble.com>
  References: <1479294998857-5930602.post@n3.nabble.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