Skip to content

Binary support for the isn contrib types #697

Closed

Description

@roji

Originally requested in #696.

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.

Activity

  1. roji commented on Jan 8, 2017

    @roji
    MemberAuthor

    Closing for lack of interest, will reopen if requested.

  2. begerard commented on Nov 30, 2022

    @begerard

    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 :)

  3. roji commented on Dec 1, 2022

    @roji
    MemberAuthor

    @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).

  4. begerard commented on Dec 1, 2022

    @begerard

    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?

  5. roji commented on Dec 1, 2022

    @roji
    MemberAuthor

    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.

  6. begerard commented on Dec 1, 2022

    @begerard

    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!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions