[jOOQ/jOOQ#11191] Generated code of a routine with TIMESTAMP parameter has too little precision

This commit is contained in:
Lukas Eder 2021-06-23 15:41:10 +02:00
parent 55ae3dcd31
commit fbb43fa884
2 changed files with 25 additions and 2 deletions

View File

@ -958,7 +958,18 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
: r1.DATA_TYPE.as("data_type"),
r1.CHARACTER_MAXIMUM_LENGTH,
r1.NUMERIC_PRECISION,
// [#12048] TODO: Maintain whether we know the precision or not
when(r1.NUMERIC_PRECISION.isNull().and(r1.DATA_TYPE.in(
inline("time"),
inline("timetz"),
inline("time without time zone"),
inline("time with time zone"),
inline("timestamp"),
inline("timestamptz"),
inline("timestamp without time zone"),
inline("timestamp with time zone"))), inline(6))
.else_(r1.NUMERIC_PRECISION).as(r1.NUMERIC_PRECISION),
r1.NUMERIC_SCALE,
r1.TYPE_UDT_SCHEMA,
r1.TYPE_UDT_NAME,

View File

@ -42,6 +42,7 @@ import static org.jooq.impl.DSL.count;
import static org.jooq.impl.DSL.inline;
import static org.jooq.impl.DSL.name;
import static org.jooq.impl.DSL.partitionBy;
import static org.jooq.impl.DSL.when;
import static org.jooq.meta.postgres.information_schema.Tables.PARAMETERS;
import static org.jooq.meta.postgres.information_schema.Tables.ROUTINES;
@ -129,7 +130,18 @@ public class PostgresRoutineDefinition extends AbstractRoutineDefinition {
p.PARAMETER_NAME,
p.DATA_TYPE,
p.CHARACTER_MAXIMUM_LENGTH,
p.NUMERIC_PRECISION,
// [#12048] TODO: Maintain whether we know the precision or not
when(p.NUMERIC_PRECISION.isNull().and(p.DATA_TYPE.in(
inline("time"),
inline("timetz"),
inline("time without time zone"),
inline("time with time zone"),
inline("timestamp"),
inline("timestamptz"),
inline("timestamp without time zone"),
inline("timestamp with time zone"))), inline(6))
.else_(p.NUMERIC_PRECISION).as(p.NUMERIC_PRECISION),
p.NUMERIC_SCALE,
p.UDT_SCHEMA,
p.UDT_NAME,