fix(datacopy): quote identifiers in pg_get_serial_sequence via format('%I.%I')
This commit is contained in:
@@ -169,8 +169,11 @@ internal static class Program
|
||||
if (max > 0)
|
||||
{
|
||||
// Keep the identity sequence above the copied max so new rows don't collide
|
||||
// %I quotes each identifier so pg_get_serial_sequence keeps the
|
||||
// exact case EF created the table/column with (unquoted literals
|
||||
// get folded to lowercase -> 42P01 "relation does not exist")
|
||||
await target.Database.ExecuteSqlRawAsync(
|
||||
$"SELECT setval(pg_get_serial_sequence('{table}', '{pkName}'), {max})");
|
||||
$"SELECT setval(pg_get_serial_sequence(format('%I.%I', '{table}', '{pkName}')), {max})");
|
||||
}
|
||||
Console.WriteLine($"\n[done ] {table}: copied={copied}, maxId={max}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user