简体   繁体   中英

Specify methods for use in index creation

Using PostGIS, you may create an index with the following;

CREATE INDEX mytable_gix
ON mytable
USING GIST (myCol);

Using JOOQ, I have access to methods such as createIndexIfNotExists

How can I maintain the method usage USING GIST with something like;

dslContext
.createIndexIfNotExists("table_gix")
.on("table")
.execute();

As of jOOQ 3.13, this syntax is not supported in the DSL API yet. You'll have to roll your own, using plain SQL templating :

dslContext.execute("create index mytable_gix on mytable using gist (mycol)");

If you have generated objects from your schema that you'd like to reuse, use the templating features:

dslContext.execute(
  "create index {0} on {1} using gist ({2})", 
  name("mytable_gix"),
  MYTABLE,
  MYTABLE.MYCOL.getUnqualifiedName()
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM