Skip to content

Commit 4d4bfb9

Browse files
committed
Postgresql: apply trunc to millisecond extraction before coversion to int8
otherwise milliseconds part of 59.999999 seconds became 0
1 parent b25803b commit 4d4bfb9

File tree

1 file changed

+2
-2
lines changed
  • Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v8_0

1 file changed

+2
-2
lines changed

Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v8_0/Translator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,11 @@ public override void Translate(SqlCompilerContext context, SqlExtract node, Extr
410410
}
411411
switch (section) {
412412
case ExtractSection.Entry:
413-
_ = context.Output.AppendOpeningPunctuation(isSecond ? "(trunc(extract(" : "(extract(");
413+
_ = context.Output.AppendOpeningPunctuation(isSecond || isMillisecond ? "(trunc(extract(" : "(extract(");
414414
break;
415415
case ExtractSection.Exit:
416416
_ = context.Output.Append(isMillisecond
417-
? ")::int8 % 1000)"
417+
? "))::int8 % 1000)"
418418
: isSecond ? ")))" : ")::int8)"
419419
);
420420
break;

0 commit comments

Comments
 (0)