我在试着设置postgREST。在http://postgrest.org/en/v5.1/tutorials/tut0.html上一直在遵循教程。这就是我所看到的。首先,模式:
entercarlson=# \dn
List of schemas
Name | Owner
--------+---------
api | carlson
public | carlson然后是一张表:
carlson=# \d api.todos
Table "api.todos"
Column | Type | Collation | Nullable | Default
--------+--------------------------+-----------+----------+---------------------------------------
id | integer | | not null | nextval('api.todos_id_seq'::regclass)
done | boolean | | not null | false
task | text | | not null |
due | timestamp with time zone | | |
Indexes:
"todos_pkey" PRIMARY KEY, btree (id)最后是一些数据:
carlson=# select * from api.todos;
id | done | task | due
----+------+-------------------+-----
1 | f | finish tutorial 0 |
2 | f | pat self on back |
(2 rows)但是我得到了这个:
$ curl http://localhost:3000/todos
{"hint":null,"details":null,"code":"42P01","message":"relation
\"api.todos\" does not exist"}这与此一致:
carlson=# \d
Did not find any relations.我做错了什么?
PS。我看不到此模式属于哪个数据库
发布于 2018-12-09 01:30:07
似乎您的目标数据库是错误的,请检查db-uri配置值,并确保此uri通过psql包含api.todos表。
另外,需要说明的是,PostgREST在每次请求时都会修改search_path,因此如果您ALTER连接用户search_path,则不会对模式PostgREST搜索产生任何影响。
https://stackoverflow.com/questions/53568097
复制相似问题