PostgreSQL 中有一个带有 ltree 字段的表。如何使用字符串值更新此字段?
DSL.using(configuration)
.update(AREAS)
.set(AREAS.TREE, area.getTree());//getTree() return String
我尝试了几种变体:
val(area.getTree()).cast(field("ltree"))
投掷A org.jooq.exception.DataAccessException has been caught, SQL [update "public"."areas" set "tree" = cast(? as any) where "public"."areas"."id" = ?]; ERROR: syntax error at or near "any"*
inline(String.format("CAST(\'%s\' AS ltree)", area.getTree()))
使用多余的引号A org.jooq.exception.DataAccessException has been caught, SQL [update "public"."areas" set "tree" = 'CAST(''1.35.1284739'' AS ltree)' where "public"."areas"."id" = ?]; ERROR: syntax error at position 4*
val(field("CAST({0} AS ltree)", area.getTree()))
投掷A org.jooq.exception.SQLDialectNotSupportedException has been caught, Type class org.jooq.impl.SQLField is not supported in dialect DEFAULT