- 论坛徽章:
- 0
|
本帖最后由 大红机器 于 2010-09-27 15:13 编辑
问题一:如何查看指定模式下的对象?我建立了一个叫mysch的模式,并且在这个模式下建立了一个表tt
然后使用\dt mysch却看不到
原来什么都看不到- postgres=# \dt
- No relations found.
复制代码 修改search_path- postgres=# set search_path to mysch,"$user",public;
- SET
- postgres=# show search_path;
- search_path
- ------------------------
- mysch, "$user", public
- (1 row)
复制代码 可以看到了- postgres=# \dt
- List of relations
- Schema | Name | Type | Owner
- --------+------+-------+----------
- mysch | tt | table | postgres
- (1 row)
复制代码 但是\dt mysch看不到- postgres=# \dt mysch
- No matching relations found.
复制代码 然后我又在public下建立了同名表tt- postgres=# create table public.tt(x varchar(8));
- CREATE TABLE
复制代码 这时又出现问题了:
用\dt发现public模式下的tt表看不到了……- postgres=# \dt
- List of relations
- Schema | Name | Type | Owner
- --------+------+-------+----------
- mysch | tt | table | postgres
- (1 row)
复制代码 查看mysch下的tt,可以查询- postgres=# select * from tt;
- x
- ---
- (0 rows)
复制代码 插入数据到public.tt- postgres=# insert into public.tt values(5);
- INSERT 0 1
复制代码 查看mysch.tt,没有数据- postgres=# select * from tt;
- x
- ---
- (0 rows)
复制代码 查看public.tt,数据已经插入成功- postgres=# select * from public.tt;
- x
- ---
- 5
- (1 row)
复制代码 晕了,求高手解惑 |
|