fix(datacopy): COUNT(*) is Int32 on SQL Server — use Convert.ToInt64
This commit is contained in:
@@ -117,8 +117,9 @@ internal static class Program
|
|||||||
|
|
||||||
foreach (var (_, table) in order)
|
foreach (var (_, table) in order)
|
||||||
{
|
{
|
||||||
long src = (long)(await ScalarAsync(srcConn, $"SELECT COUNT(*) FROM {table}"))!;
|
// SQL Server COUNT(*) is Int32, Postgres is Int64 — Convert handles both
|
||||||
long dst = (long)(await ScalarAsync(pgConn, $"SELECT COUNT(*) FROM \"{table}\""))!;
|
long src = Convert.ToInt64(await ScalarAsync(srcConn, $"SELECT COUNT(*) FROM {table}"))!;
|
||||||
|
long dst = Convert.ToInt64(await ScalarAsync(pgConn, $"SELECT COUNT(*) FROM \"{table}\""))!;
|
||||||
if (src != dst) problems++;
|
if (src != dst) problems++;
|
||||||
Console.WriteLine($"{(src == dst ? "OK " : "FAIL ")} {table,-28} source={src,-10} target={dst}");
|
Console.WriteLine($"{(src == dst ? "OK " : "FAIL ")} {table,-28} source={src,-10} target={dst}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user