-
Notifications
You must be signed in to change notification settings - Fork 53
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
PostgresException 42804 UNION with xid and text not match on include #193
Comments
The xid type is internally represented using a 32-bit unsigned integer (which is also not supported by EF6). Could you maybe try to represent it as a 32-bit signed integer instead of a string? |
But the best way would be to try to avoid using |
@Emill Thanks for your reply. Sadly using a 32-bit unsigned integer generate error on insert, update and select. And for now we have not find a alternative of xmin for our needs. The MSSQL Timestamp field value is generated by the database. The value is unique across all the table of the database and allow concurrency check. We need all this features because we have a mobile application that synchronize datas and work on disconnected mode. xmin was naturally our target to replace MSSQL timestamp field because it match our requirements. |
If you are about to migrate your setup anyway, maybe move over to the newer EF Core? EF6 is pretty old and very limited in terms of data type possibilities. |
I see your point of view but migrate to Core our application is an another step of work that we cannot make yet. |
No help from the NPGSQL team ? It seems that is clearly a bug from the entityframework driver and the query generation. Thanks for your help |
@willignicolas The EF6 provider is no longer being actively developed (like EF6 itself), and in any case, @Emill knows as much as anyone in the team here, probably more :) |
I would rather say it's a limitation in the core of Entity Framework 6, i.e. that you cannot have any other data types for your fields than the basic types int, string, date, etc. We have tried working around this as much as possible; for simple queries using "text" for unknown data types works. This is the case when the query can be written in such a way that the data type does not need to be enforced as when the server can infer the type from the context, i.e. when quotes can be used without specifying a type, as |
ok thanks for your reply and your help. |
Hello @Emill We explore some other solution like sequence and put nextval on default value of create table (we don't use code first migration)
Now we try to find a solution to use nextval on update generated query like this :
Is there any solution to tell EF6 Npgsql provider to use "nextval" function on all update for the AccountTs property ? Thanks for your help. |
Not what I know of. I think you should be able to define a Trigger directly in PostgreSQL though to do this on every update. |
Ok thank you for your reply. |
Hello,
We try to migrate from MSSQL to Postgresql on our EntityFramework 6 code first application.
We have migrate a ByteArray rowversion field in MSSQL to the xmin field mapped on a string property on the EF model by follow this documentation :
https://www.npgsql.org/ef6/index.html#optimistic-concurrency
Insert, update and select works fine. But in a few case with multiple include we have the error :
PostgresException: 42804: les UNION types xid et text ne peuvent pas correspondre
Same error on PGAdmin if I log the generated entityframework sql query but with a few more details
ERROR: ERREUR: les UNION types xid et text ne peuvent pas correspondre
LINE 177: CAST (NULL AS text) AS "C13",
Have you any idea how we can resolved this issue ?
Thanks.
Threre is the full generated sql query :
The text was updated successfully, but these errors were encountered: