Skip to content

Error when doing unions where projections contain NULL values #3283

@edgar-tamm-uptime

Description

@edgar-tamm-uptime

Hello,

Stumbled upon a similar case as #2366, but the error still happens.

Package: "Npgsql.EntityFrameworkCore.PostgreSQL" version 8.0.4

Sample that reproduces error:
EFCoreUnionWithNullsError.zip

Hopefully using Aspire is fine as it was the easiest way to give a open & run the example reproduction (assuming you have Aspire Workflow & Docker).
The main project is the "App" project, this can be run without Aspire, but you will need a postgresql instance & pass in the connection string as the first argument.

When run it should give an error with the following message: UNION types text and bigint cannot be matched.

Hopefully the example is not too messy (and doesn't look too contrived as it basically is what is done in the actual app).

Additional note (as described in comments in 2366), I managed to work around the issue, by having custom DbFunctions which add type casts to each NULL value.

If you need more info I will try to provide it.

Thank you.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions