首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >postgREST可以找到关系

postgREST可以找到关系
EN

Stack Overflow用户
提问于 2018-12-01 13:42:36
回答 1查看 297关注 0票数 0

我在试着设置postgREST。在http://postgrest.org/en/v5.1/tutorials/tut0.html上一直在遵循教程。这就是我所看到的。首先,模式:

代码语言:javascript
复制
entercarlson=# \dn
List of schemas
Name  |  Owner
--------+---------
api    | carlson
public | carlson

然后是一张表:

代码语言:javascript
复制
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)

最后是一些数据:

代码语言:javascript
复制
carlson=# select * from api.todos;
 id | done |       task        | due
----+------+-------------------+-----
  1 | f    | finish tutorial 0 |
  2 | f    | pat self on back  |
(2 rows)

但是我得到了这个:

代码语言:javascript
复制
$ curl http://localhost:3000/todos
{"hint":null,"details":null,"code":"42P01","message":"relation 
 \"api.todos\" does not exist"}

这与此一致:

代码语言:javascript
复制
carlson=# \d
Did not find any relations.

我做错了什么?

PS。我看不到此模式属于哪个数据库

EN

回答 1

Stack Overflow用户

发布于 2018-12-09 01:30:07

似乎您的目标数据库是错误的,请检查db-uri配置值,并确保此uri通过psql包含api.todos表。

另外,需要说明的是,PostgREST在每次请求时都会修改search_path,因此如果您ALTER连接用户search_path,则不会对模式PostgREST搜索产生任何影响。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53568097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档