Postgresql postgREST可以找到关系
我正在试着设置postgREST。我们一直在学习教程。这是我看到的。首先,模式:Postgresql postgREST可以找到关系,postgresql,postgrest,Postgresql,Postgrest,我正在试着设置postgREST。我们一直在学习教程。这是我看到的。首先,模式: entercarlson=# \dn List of schemas Name | Owner --------+--------- api | carlson public | carlson 然后是一张桌子: carlson=# \d api.todos Table "api.todos" Column |
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.
我做错了什么
另外,我看不出此架构属于哪个数据库似乎您针对的是错误的数据库,请检查db uri config值,并确保此uri通过psql包含api.todos表
另外,要澄清的是,搜索路径是由PostgREST在每个请求上修改的,因此,如果更改连接用户搜索路径,它将不会对模式PostgREST搜索产生任何影响 您在postgrest配置文件中对db模式使用什么值?它应该是api,以匹配存储表的位置。