我创建了一个名为indexes的新表空间,我试图删除旧的表空间indexes_old,它用来包含一些表和索引.当我尝试删除表空间时,我得到:
=> drop tablespace indexes_old; ERROR: tablespace "indexes_old" is not empty
但是,当我尝试看看那里有什么,似乎没有表生活在该表空间中:
=> select * from pg_tables where tablespace = 'indexes_old'; schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers ------------+-----------+------------+------------+------------+----------+------------- (0 rows) => select * from pg_indexes where tablespace = 'indexes_old'; schemaname | tablename | indexname | tablespace | indexdef ------------+-----------+-----------+------------+---------- (0 rows)
那么那个表空间是什么阻止我放弃它呢?
如果重要,我刚刚使用pg_upgrade工具从Pg 8.4迁移到Pg 9.0.
表空间如下所示:
Name | Owner | Location | Access privileges | Description -------------+----------+-----------------+-------------------+------------- indexes | nobody | /data/pgindex90 | | indexes_old | nobody | /data/pgindex84 | |
并且/ data / pgindex84的内容包括所有旧的8.4索引,加上pg_upgrade自动创建的新的9.0索引
# sudo ls -al /data/pgindex84/PG_9.0_201008051/11874 total 8280 drwx------ 2 postgres postgres 4096 Feb 9 14:58 . drwx------ 3 postgres postgres 4096 Feb 11 09:28 .. -rw------- 1 postgres postgres 40960 Feb 9 14:58 10462602 -rw------- 1 postgres postgres 40960 Feb 9 14:58 10462604 -rw------- 1 postgres postgres 4644864 Feb 9 14:58 10462614 -rw------- 1 postgres postgres 3727360 Feb 9 14:58 10462616
检查pg_class以查看位于哪里:
SELECT c.relname,t.spcname FROM pg_class c JOIN pg_tablespace t ON c.reltablespace = t.oid WHERE t.spcname = 'indexes_old';
原文地址:https://www.jb51.cc/postgresql/192723.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。