[jOOQ/jOOQ#14256] Syntax error when from current_timestamp when precision bind value is specified for Postgres
This commit is contained in:
parent
ca4964b9aa
commit
c1e53deee6
@ -40,16 +40,19 @@ package org.jooq.impl;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
import static org.jooq.impl.Keywords.K_CURRENT;
|
||||
import static org.jooq.impl.Keywords.K_FRACTION;
|
||||
import static org.jooq.impl.Keywords.K_TIMESTAMP;
|
||||
@ -73,7 +76,8 @@ import org.jooq.SQLDialect;
|
||||
*/
|
||||
final class CurrentTimestamp<T> extends AbstractField<T> implements QOM.CurrentTimestamp<T> {
|
||||
|
||||
private static final Set<SQLDialect> NO_SUPPORT_PRECISION = SQLDialect.supportedBy(CUBRID, DERBY, SQLITE);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_PRECISION = SQLDialect.supportedBy(CUBRID, DERBY, SQLITE);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_PRECISION_BIND = SQLDialect.supportedBy(POSTGRES);
|
||||
|
||||
private final Field<Integer> precision;
|
||||
|
||||
@ -134,7 +138,10 @@ final class CurrentTimestamp<T> extends AbstractField<T> implements QOM.CurrentT
|
||||
|
||||
default:
|
||||
if (precision != null && !NO_SUPPORT_PRECISION.contains(ctx.dialect()))
|
||||
ctx.visit(K_CURRENT).sql('_').visit(K_TIMESTAMP).sql('(').visit(precision).sql(')');
|
||||
if (NO_SUPPORT_PRECISION_BIND.contains(ctx.dialect()))
|
||||
ctx.visit(K_CURRENT).sql('_').visit(K_TIMESTAMP).sql('(').paramType(INLINED, c -> c.visit(precision)).sql(')');
|
||||
else
|
||||
ctx.visit(K_CURRENT).sql('_').visit(K_TIMESTAMP).sql('(').visit(precision).sql(')');
|
||||
else
|
||||
ctx.visit(K_CURRENT).sql('_').visit(K_TIMESTAMP);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user