H2数据库'grant role'错误(H2 database 'grant role' error)

编程入门 行业动态 更新时间:2024-10-26 16:26:16
H2数据库'grant role'错误(H2 database 'grant role' error)

我正在使用H2数据库编写一些数据库创建脚本,但无法授予我创建的角色。 我的脚本是:

create user MY_READWRITEUSER password 'MY_READWRITEUSER'; create user MY_OWNER password 'MY_OWNER' admin ; create schema MY_OWNER AUTHORIZATION MY_OWNER; set schema MY_OWNER; create role MY_READ_ROLE; create role MY_RW_ROLE; grant role MY_RW_ROLE to MY_OWNER; grant role MY_RW_ROLE to MY_READWRITEUSER; grant role MY_READ_ROLE to MY_READUSER;

但当我点击授权角色时,H2会抱怨:

[Error Code: 42001, SQL State: 42001] Syntax error in SQL statement "GRANT ROLE MY_RW_ROLE[*] TO MY_OWNER "; expected ",, TO"; SQL statement:

我没有看到任何语法错误 - 我做错了什么?

H2版本1.4.191

I'm writing some database creation scripts using H2 database but can't grant the roles I create. My script is:

create user MY_READWRITEUSER password 'MY_READWRITEUSER'; create user MY_OWNER password 'MY_OWNER' admin ; create schema MY_OWNER AUTHORIZATION MY_OWNER; set schema MY_OWNER; create role MY_READ_ROLE; create role MY_RW_ROLE; grant role MY_RW_ROLE to MY_OWNER; grant role MY_RW_ROLE to MY_READWRITEUSER; grant role MY_READ_ROLE to MY_READUSER;

but when I hit the grant role lines H2 complains:

[Error Code: 42001, SQL State: 42001] Syntax error in SQL statement "GRANT ROLE MY_RW_ROLE[*] TO MY_OWNER "; expected ",, TO"; SQL statement:

I don't see any syntax error - what am I doing wrong?

H2 version 1.4.191

最满意答案

通常情况下 - 如果我问的话,我会在几分钟后找出答案。

有语法错误。 这个:

grant role MY_RW_ROLE to MY_OWNER;

应该这样说:

grant MY_RW_ROLE to MY_OWNER;

Often the case - if I ask on SO I figure out the answer myself minutes later.

There is a syntax error. This:

grant role MY_RW_ROLE to MY_OWNER;

should say this:

grant MY_RW_ROLE to MY_OWNER;

更多推荐

本文发布于:2023-07-26 02:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269565.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   数据库   grant   error   database

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!