[jOOQ/jOOQ#17489] Invalid constraint type "n" in jOOQ-meta query on PostgreSQL 17 when trying to fetch pg_get_constraintdef for a NOT NULL constraint on a domain

This commit is contained in:
Lukas Eder 2024-10-23 16:20:14 +02:00
parent 506e0766bc
commit 148bc522c4
2 changed files with 8 additions and 5 deletions

View File

@ -923,7 +923,9 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
d.OID,
d.TYPBASETYPE,
c.CONNAME,
when(c.OID.isNotNull(), array(constraintDef))
// [#17489] PG 17 added NOT NULL constraints for domains to this table
when(c.OID.isNotNull().and(c.CONTYPE.ne(inline("n"))), array(constraintDef))
)
.from(d)
.leftJoin(c)
@ -936,9 +938,10 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
d.OID,
d.TYPBASETYPE,
c.CONNAME,
decode()
.when(c.CONBIN.isNull(), src)
.otherwise(arrayAppend(src, constraintDef))
// [#17489] PG 17 added NOT NULL constraints for domains to this table
when(c.CONBIN.isNull().and(c.CONTYPE.ne(inline("n"))), src)
.else_(arrayAppend(src, constraintDef))
)
.from(name("domains"))
.join(d)

View File

@ -278,7 +278,7 @@ implements
// [#2883][#9109] PostgreSQL and H2 can use the DISTINCT keyword with formal row value expressions.
// [#13415] ListAgg is a special case, where the second argument is the separator
if (parens |= (args.size() > 1 && REQUIRE_DISTINCT_RVE.contains(ctx.dialect()) && !(this instanceof ListAgg)))
if (parens |= (args.size() > 1 && REQUIRE_DISTINCT_RVE.contains(ctx.dialect()) && !(this instanceof ListAgg) && !(this instanceof BinaryListAgg)))
ctx.sql('(');
}