Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL - The binary import operation was started with x column(s), but y value(s) were provided. #1484

Open
fmjnax opened this issue May 8, 2024 · 0 comments

Comments

@fmjnax
Copy link

fmjnax commented May 8, 2024

Version 8.0.3

Code in question:

public class JobValidationResult
{
    public Guid Id { get; set; }
    public Guid JobId { get; set; }
    public string Validator { get; set; } = string.Empty;
    public int RowIndex { get; set; }
    public bool IsSuccess { get; set; } = true;
    public string Message { get; set; } = string.Empty;

    public Job Job { get; set; } = new();
}

--------

var bulkConfig = new BulkConfig
{
    PropertiesToInclude = new List<string>
    {
        nameof(JobValidationResult.JobId),
        nameof(JobValidationResult.Validator),
        nameof(JobValidationResult.RowIndex),
        nameof(JobValidationResult.IsSuccess),
        nameof(JobValidationResult.Message)
    }
};

await _dbContext.BulkInsertAsync(failedResults, bulkConfig);

The "failedResults" variable is a List<JobValidationResult>. An example of one of the entries in the list:
Id: {00000000-0000-0000-0000-000000000000}
IsSuccess: false
Job: {ETLSchema.Job}
JobId: {65857f48-dbea-4bf4-80ac-fb829b602a66}
Message: "TestField is blank/empty"
RowIndex: 1
Validator: "CheckNonEmpty : Row 1, Field TestField"

The "Id" field is an auto-generated UUID on the database so it doesn't need to be inserted.
The "Job" is a navigational property

No matter what I do, I get the following error:
The binary import operation was started with 5 column(s), but 6 value(s) were provided.

I have tried both the 'PropertiesToExclude' and 'PropertiesToInclude' BulkConfig options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant