Jimmy Lu
Jimmy Lu

Reputation: 398

jOOQ code generator does not generate corresponding Index if a UNIQUE index has the function defined on the field

I have a unique index as below to achieve case-insensitive unique constraint on the project name

CREATE UNIQUE INDEX IF NOT EXISTS unique_project_name__idx ON project (UPPER(name));

It seems that jOOQ code generator does not generate the corresponding constant in Indexes.java for such UNIQUE index.

However, it works for the index without UPPER() function

CREATE UNIQUE INDEX IF NOT EXISTS unique_project_name__idx ON project (name);
// corresponding generation in Indexes.java
public static Index UNIQUE_PROJECT_NAME__IDX = Internal.createIndex("unique_project_name__idx", Project.PROJECT, new OrderField[] { Project.PROJECT.NAME }, true);

I use jOOQ 3.13.2 and PostgreSQL 11.2.

Any idea?

Is citext a better way for case-insensitive unique constraint?

Upvotes: 4

Views: 625

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 220987

This is a missing feature in jOOQ 3.13: https://github.com/jOOQ/jOOQ/issues/6310

Upvotes: 4

Related Questions