According to the docs, the CREATE USER
syntax on HSQLDB is:
CREATE USER <user name> PASSWORD <password> [ ADMIN ]
The statement provides no way to check if the user exists (à la CREATE USER IF NOT EXISTS
), and will fail if a user <user name>
already exists.
Digging a little deeper, I found that existing users can be enumerated with
SELECT USER_NAME FROM INFORMATION_SCHEMA.SYSTEM_USERS;
How can I add this check to a one-liner (i.e. one I can run e.g. via DatabaseManager)?
While most CREATE statements support IF NOT EXISTS, there is no way to do this for CREATE USER.