0

我正在尝试一个新事物,但我被困在教程中。当我按照本教程的第 4 步进行操作时:

https://postgrest.org/en/v9.0/tutorials/tut0.html#step-4-create-database-for-api

SQL 只是运行没有错误。我可以看到表格+数据。

但是,当我以新创建的用户身份登录authenticator并尝试select * from api.todos;时,我收到错误消息:

ERROR:  permission denied for schema api
LINE 1: select * from api.todos;

我在我的Postgres.app上的 Postgres 13+14以及 Debian 上的 Postgres 13.4 上进行了尝试。同样的错误。

这里有什么帮助吗?

4

1 回答 1

1

是的,这是故意的。如https://postgrest.org/en/v9.0/auth.html#authentication-sequenceauthenticator所述,除了切换角色之外没有任何特权。

因此,在与authenticatorthrough连接后psql,您可以执行以下操作:

set local role web_anon;

那么你应该可以select * from api.todos

于 2021-12-07T17:37:03.007 回答