模式管理 dt public.t3 List of relations Schema Name Type Owner +++ public t3 table teledb (1 row) 同名的表查询时,没有指定shema时,始终只会查到前面模式的表数据。 插入数据到public.t3表 plaintext teledb insert into public.t3 values(1,'test'); INSERT 0 1 由于teledb模式在第一顺位,且存在同名表,所以始终是teledb模式下的空表 teledb select from t3; id content + (0 rows) 指定public模式去查询可以查到插入的数据 teledb select from public.t3; id content + 1 test (1 row) 访问不在搜索路径的对象时,需要写全路径。 plaintext teledb create table test1.t4 (id int, name char); CREATE TABLE teledb select from t4; ERROR: relation "t4" does not exist LINE 1: select from t4; ^ teledb select from test1.t4; id name + (0 rows) 上面出错是因为模式test1没有配置在searchpath搜索路径中。