Ynv
Ynv

Reputation: 1974

Using PostgreSQL CITEXT Extension with jOOQ

The Postgres CITEXT extension helps with cases-insensitive data. This, for example, can be useful when working with emails. See here and here. I've defined the following table:

CREATE EXTENSION citext;

CREATE TABLE user (
  user_id   INTEGER PRIMARY KEY,
  email     CITEXT  NOT NULL UNIQUE,
  password  TEXT    NOT NULL,
  salt      TEXT    NOT NULL
);

and added the following to the <database> section in the pom.xml:

<forcedType>
  <name>CLOB</name>
  <expression>public.user.email</expression>
  <types>CITEXT</types>
  </forcedType>
</forcedTypes>

When I run the code generator, the fields do get generated, but there are a lot of "missing name" warnings in the log output. For example:

[INFO] Generating routine       : CitextLt.java
[WARNING] Missing name          : Object citext_ne holds a column without a name at position 1

Am I on the right track on integrating the CITEXT extesion with jOOQ?

If so, how do I provide these missing names?

Upvotes: 3

Views: 775

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221145

There are two issues in this question:

Logging

The WARN level is perhaps a bit excessive. I've registered an issue to revert that to INFO: https://github.com/jOOQ/jOOQ/issues/5385

You don't have to worry about those warnings. PostgreSQL supports declaring stored procedures whose parameters are unnamed and can be referenced only by parameter index / position. jOOQ's code generator only indicates that this is "unusual" and that a synthetic parameter name is generated.

This should not affect your using CITEXT with jOOQ.

Your forced type configuration

There is currently a bug that prevents you from matching user-defined types with <types/>: http://github.com/jOOQ/jOOQ/issues/5363

Just remove your <types/> element, and it will work.

Upvotes: 1

Related Questions