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

BulkRead not working with Postgres database when including "xmin" column #1185

Open
PatriQ94 opened this issue Jun 28, 2023 · 3 comments
Open

Comments

@PatriQ94
Copy link

PatriQ94 commented Jun 28, 2023

What I'm trying to do is to read large amounts of data by a large list of Ids. I have a database model that looks like this:

public class Partner
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public string? FirstName { get; set; }
	
    [Timestamp]
    [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
    [Column("xmin", TypeName = "xid")]
    public uint RowVersion { get; set; }
}

Then I have a large list of Ids, which can contain hundred of thousands of records, and a query like this:

List<Guid> idsToFetch = new(); // bunch of Ids
var items = idsToFetch.Select(a => new Partner { Id = a }).ToList();
var bulkConfig = new BulkConfig
{
    UpdateByProperties = new List<string> { nameof(Partner.Id) },
};
await _context.BulkReadAsync(items, bulkConfig); 

The error I constantly keep receiving is The required column 'xmin' was not present in the results of a 'FromSql' operation..
I've tried enablind EnableShadowProperties property, as well as exclude the RowVersion property entirely, but always same error.
EFCore version: 7.0.7
EFCore.BulkExtensions version: 7.1.2
Postgres version: 15.2
Any way to solve this?

@borisdj
Copy link
Owner

borisdj commented Jun 28, 2023

Can confirm the issue, it happens on casting to 'List', but not sure how to solve it.

@PatriQ94
Copy link
Author

Can confirm the issue, it happens on casting to 'List', but not sure how to solve it.

I see. Is there plans perhaps to investigate this further or...?

@borisdj
Copy link
Owner

borisdj commented Jun 30, 2023

I'll leave it open for now, maybe later something comes to mind.

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

No branches or pull requests

2 participants