Stack Exchange
Return table CHECK Constraints in JOOQ
I have a table in my PostgreSQL database, which was generated using the following Jooq query:
context.createTable("object_brick_car")
        .column(field(name("id"), Integer.class), SQLDataType.INTEGER.identity(true))
        .primaryKey("id")
        .column("record_id", INTEGER)
        .column("field_name", VARCHAR(255))
        .column("capacity", INTEGER)
        .column("power", INTEGER.default_(0))
        .constraints(
            constraint("company_index_check")
                .check(field(name("power"), INTEGER).between(0, 500)),
            constraint("object_brick_car_foreign_key").foreignKey("record_id").references("object_store_car", "id")
        ).execute();

This table generated correctly, logger shows the following SQL query being executed:
create table "object_brick_car" ("id" int generated by default as identity not null, "record_id" int, "field_name" varchar(255), "capacity" int, "power" int default 0, primary key ("id"), constraint "company_index_check" check ("power" between 0 and 500), constraint "object_brick_car_foreign_key" foreign key ("record_id") references "object_store_car" ("id"))

I want to retrieve metainformation about this table using Jooq API. I can collect information about data types, foreign and primary keys, uniqness constraints, etc.
But when I tried to collect information about "company_index_check" via Table.getChecks() I received empty list:
Table metadata
                   Indices: 
                  Primary key: constraint "object_brick_car_pkey" primary key ("id") Checks: {} 
                   Foreign keys: constraint "object_brick_car_foreign_key"

Is there any option to receive a list of checks via Jooq API and map them onto Check objects?
The Jooq version is 3.18.7

As of jOOQ 3.19, CHECK constraints aren't available from org.jooq.Meta API, but there's no reason not to support those in the future:

https://github.com/jOOQ/jOOQ/issues/16190

Note the historic reason for some meta data being absent in org.jooq.Meta is simply because that API is mainly JDBC DatabaseMetaData backed, and that API is very limited. But jOOQ has internal vendor specific queries used for the code generator that can also be used in org.jooq.Meta
