Search code examples
sqlhsqldbuser-defined-typescreate-table

HSQLDB "CREATE TYPE": "type not found or user lacks privilege"


Goal

To use a CREATE TYPE statement in HSQLDB 2.0.0 to create a user-defined type, and to use that user-defined type in a CREATE TABLE statement.

Example

CREATE TYPE MASK_TYPE AS SMALLINT;
CREATE TABLE MY_TABLE(MY_MASK MASK_TYPE NOT NULL);

Problem

When I execute the example, I see the following error message:

type not found or user lacks privilege: MASK_TYPE

Questions

  1. What errors, if any, exist in the syntax of the example?
  2. How might I achieve my goal?

Thank you!


Solution

  • The syntax is correct. You need to execute each statement separately.

    Update: This does not work with 2.0.0 but works in the latest 2.2.8