You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PostgreSQL contrib module isn contains useful types for ISBNs, ISSNs, etc.
Unfortunately the module doesn't provide binary in/out functions, so these have to be added first and merged in PostgreSQL. Then, an Npgsql type handler can be created.
Is there a centralized way to configure this conversion on the property of an entity? Perhaps with fluent configuration in the DbContext or with the npgsqlOptions in startup?
From a more general standpoint, this module is included in the instances deployed by the new Azure Cosmos DB PostgreSQL offer, so at least their team have deemed it of general interest :)
@begerard unfortunately, the lack of binary support for ISN on the PostgreSQL means that you need to apply the workaround (UnknownResultTypeList) at the ADO.NET level. I don't think integrating this into the EF provider would be easy - have you been successful, and are only looking for a centralized way to do this?
From a more general standpoint, this module is included in the instances deployed by the new Azure Cosmos DB PostgreSQL offer, so at least their team have deemed it of general interest :)
isn is one of the "bundled" plugins that comes with any PG installation, so the fact that it's included with Cosmos PG probably doesn't mean anyone thinks it's important (or even knows about it).
isn is one of the "bundled" plugins that comes with any PG installation, so the fact that it's included with Cosmos PG probably doesn't mean anyone thinks it's important (or even knows about it).
Oh ok, I though they added it intentionally. It is a indeed for very niche types.
@begerard unfortunately, the lack of binary support for ISN on the PostgreSQL means that you need to apply the workaround (UnknownResultTypeList) at the ADO.NET level. I don't think integrating this into the EF provider would be easy - have you been successful, and are only looking for a centralized way to do this?
I was looking for a way to do it without going in the low level of EF, and preferably in a centralized way. If I cannot use it without handling the commands myself in the application, can a package handle it properly, like there is one for NodaTime?
If yes do you have pointers or examples to do it cleanly?
Supporting an unknown type in EF would require several things:
For reading results, a command interceptor would need to set UnknownResultTypeList. That should allow mapping the results back to a string property in EF.
Bottom line, I don't think it's a practicable option at this point (and most probably not worth the effort). If #4053 is done, a command interceptor could also do the proper arrangements for sending the .NET string as the PG text representation.
Ok, I can understand that supporting unknown DB types isn't that easy actually.
In my case I'll take the easy route and hide a bigint inside a .Net type, DB support of ISN is only a nice to have feature after all.
Activity
roji commentedon May 31, 2016
Patch for binary I/O support submitted: https://www.postgresql.org/message-id/CADT4RqCjwFxq9-yLzPN1FE9pGtNZbxngSzfVRNTHzFDardU-vw@mail.gmail.com
roji commentedon May 31, 2016
Commitfest link: https://commitfest.postgresql.org/10/639/
roji commentedon Jan 8, 2017
Closing for lack of interest, will reopen if requested.
begerard commentedon Nov 30, 2022
Hey @roji I'm interested to use the ISN module of postgresql (to finally have typed binary column instead of text!) but it does not have performance requirement as of now so I checked your TEXT work around: https://www.npgsql.org/doc/faq.html#a-nameunknowntypei-get-an-exception-the-field-field1-has-a-type-currently-unknown-to-npgsql-oid-xxxxx-you-can-retrieve-it-as-a-string-by-marking-it-as-unknowna
Is there a centralized way to configure this conversion on the property of an entity? Perhaps with fluent configuration in the DbContext or with the npgsqlOptions in startup?
From a more general standpoint, this module is included in the instances deployed by the new Azure Cosmos DB PostgreSQL offer, so at least their team have deemed it of general interest :)
roji commentedon Dec 1, 2022
@begerard unfortunately, the lack of binary support for ISN on the PostgreSQL means that you need to apply the workaround (UnknownResultTypeList) at the ADO.NET level. I don't think integrating this into the EF provider would be easy - have you been successful, and are only looking for a centralized way to do this?
isn is one of the "bundled" plugins that comes with any PG installation, so the fact that it's included with Cosmos PG probably doesn't mean anyone thinks it's important (or even knows about it).
begerard commentedon Dec 1, 2022
Oh ok, I though they added it intentionally. It is a indeed for very niche types.
I was looking for a way to do it without going in the low level of EF, and preferably in a centralized way. If I cannot use it without handling the commands myself in the application, can a package handle it properly, like there is one for NodaTime?
If yes do you have pointers or examples to do it cleanly?
roji commentedon Dec 1, 2022
Supporting an unknown type in EF would require several things:
Bottom line, I don't think it's a practicable option at this point (and most probably not worth the effort). If #4053 is done, a command interceptor could also do the proper arrangements for sending the .NET string as the PG text representation.
begerard commentedon Dec 1, 2022
Ok, I can understand that supporting unknown DB types isn't that easy actually.
In my case I'll take the easy route and hide a bigint inside a .Net type, DB support of ISN is only a nice to have feature after all.
Thanks for your help Roji!