HHH-17520 Schema creation fails with interval second data type on PostgreSQL
This commit is contained in:
parent
ddb3e579e7
commit
1e21da14cd
|
@ -1144,6 +1144,12 @@ public class CockroachLegacyDialect extends Dialect {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultIntervalSecondScale() {
|
||||||
|
// The maximum scale for `interval second` is 6 unfortunately
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
// CockroachDB doesn't support this by default. See sql.multiple_modifications_of_table.enabled
|
// CockroachDB doesn't support this by default. See sql.multiple_modifications_of_table.enabled
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
|
|
|
@ -1460,4 +1460,10 @@ public class PostgreSQLLegacyDialect extends Dialect {
|
||||||
}
|
}
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultIntervalSecondScale() {
|
||||||
|
// The maximum scale for `interval second` is 6 unfortunately
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1138,6 +1138,11 @@ public class CockroachDialect extends Dialect {
|
||||||
return new CockroachDialectQueryHints(query, hintList).getQueryHintString();
|
return new CockroachDialectQueryHints(query, hintList).getQueryHintString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultIntervalSecondScale() {
|
||||||
|
// The maximum scale for `interval second` is 6 unfortunately
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// CockroachDB doesn't support this by default. See sql.multiple_modifications_of_table.enabled
|
// CockroachDB doesn't support this by default. See sql.multiple_modifications_of_table.enabled
|
||||||
|
|
|
@ -5391,4 +5391,17 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun
|
||||||
public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport() {
|
public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport() {
|
||||||
return FunctionalDependencyAnalysisSupportImpl.NONE;
|
return FunctionalDependencyAnalysisSupportImpl.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves the default scale for a {@link SqlTypes.INTERVAL_SECOND} type code for the given column
|
||||||
|
* <p>
|
||||||
|
* Usually 9 (nanosecond) or 6 (microseconds).
|
||||||
|
*
|
||||||
|
* @return the default scale, in decimal digits,
|
||||||
|
* of the fractional seconds field
|
||||||
|
*/
|
||||||
|
public int getDefaultIntervalSecondScale(){
|
||||||
|
// The default scale necessary is 9 i.e. nanosecond resolution
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1541,4 +1541,10 @@ public class PostgreSQLDialect extends Dialect {
|
||||||
return "$" + position;
|
return "$" + position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultIntervalSecondScale() {
|
||||||
|
// The maximum scale for `interval second` is 6 unfortunately
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,8 +161,7 @@ public class DurationJavaType extends AbstractClassJavaType<Duration> {
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultSqlScale(Dialect dialect, JdbcType jdbcType) {
|
public int getDefaultSqlScale(Dialect dialect, JdbcType jdbcType) {
|
||||||
if ( jdbcType.getDdlTypeCode() == SqlTypes.INTERVAL_SECOND ) {
|
if ( jdbcType.getDdlTypeCode() == SqlTypes.INTERVAL_SECOND ) {
|
||||||
// The default scale necessary is 9 i.e. nanosecond resolution
|
return dialect.getDefaultIntervalSecondScale();
|
||||||
return 9;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// For non-interval types, we use the type numeric(21)
|
// For non-interval types, we use the type numeric(21)
|
||||||
|
|
Loading…
Reference in New Issue