Skip to content

Commit 966f716

Browse files
committed
Don't correct aggregates if there is option to trim insignificant zeros
1 parent 26fe487 commit 966f716

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Orm/Xtensive.Orm.PostgreSql/Orm.Providers.PostgreSql/DomainHandler.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,24 @@ namespace Xtensive.Orm.Providers.PostgreSql
1818
/// </summary>
1919
public class DomainHandler : Providers.DomainHandler
2020
{
21+
/// <summary>
22+
/// <see langword="true"/> if storage can trim insignificant zeros in numeric values
23+
/// </summary>
24+
protected bool HasNativeTrimOfInsignificantDecimalPoints =>
25+
Handlers.ProviderInfo.StorageVersion.Major < 13;
26+
2127
/// <inheritdoc/>
2228
protected override ICompiler CreateCompiler(CompilerConfiguration configuration) =>
2329
new SqlCompiler(Handlers, configuration);
2430

2531
/// <inheritdoc/>
2632
protected override IPreCompiler CreatePreCompiler(CompilerConfiguration configuration)
2733
{
28-
var decimalAggregateCorrector = new AggregateOverDecimalColumnCorrector(Handlers.Domain.Model);
29-
return new CompositePreCompiler(decimalAggregateCorrector, base.CreatePreCompiler(configuration));
34+
if (HasNativeTrimOfInsignificantDecimalPoints) {
35+
var decimalAggregateCorrector = new AggregateOverDecimalColumnCorrector(Handlers.Domain.Model);
36+
return new CompositePreCompiler(decimalAggregateCorrector, base.CreatePreCompiler(configuration));
37+
}
38+
return base.CreatePreCompiler(configuration);
3039
}
3140

3241
/// <inheritdoc/>

0 commit comments

Comments
 (0)