2

I'm running a script on H2 that does the following:

create role admin_role;
create user app_user password 'password' ;

grant admin_role to app_user;

create sequence from_event_seq;
grant select on from_event_seq to admin_role;

Frustratingly this is not working and I get the following error:

 [Error Code: 42102, SQL State: 42S02]  Table "FROM_EVENT_SEQ" not found; SQL statement: grant select on  from_event_seq to admin_role [42102-154]

The odd thing is that the error message seems to think I am trying to grant to a table (42102 is a table not found error). Also, I can actually query the sequence and it works (which means that it has been created). The grant syntax for H2 doesn't specify what object type the grant should be applied to.

What am I missing?

Dave Richardson
  • 4,880
  • 7
  • 32
  • 47

1 Answers1

7

So...reading the H2 documentation a bit closer (see here) shows that the 'grant right' statement in h2 only applies to tables. Hence the error. Since I am using H2 for unit testing and the scripts are ulimately to run on Oracle I will need to skip the grants for the time being.

Dave Richardson
  • 4,880
  • 7
  • 32
  • 47