DB 삽입위치 변경, 업데이트 로직 개선
This commit is contained in:
@@ -177,9 +177,9 @@ func copyAndUpsertCSV(ctx context.Context, conn *pgx.Conn, path, schema, table s
|
||||
_ = tx.Rollback(ctx)
|
||||
}()
|
||||
|
||||
tempTable := fmt.Sprintf("%s_import_tmp", table)
|
||||
tempTable := fmt.Sprintf("%s_import_tmp_%d", table, time.Now().UnixNano())
|
||||
|
||||
if _, err := tx.Exec(ctx, fmt.Sprintf(`CREATE TEMP TABLE %s (LIKE %s INCLUDING ALL);`, quoteIdent(tempTable), pgx.Identifier{schema, table}.Sanitize())); err != nil {
|
||||
if _, err := tx.Exec(ctx, fmt.Sprintf(`CREATE TEMP TABLE %s (LIKE %s INCLUDING ALL) ON COMMIT DROP;`, quoteIdent(tempTable), pgx.Identifier{schema, table}.Sanitize())); err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user