Skip to content

PostgreSQL composite type support #22

Open

Description

@roji

In npgsql/npgsql@a9401b1 I added composite type support, but since then EFCore changed things in a way that breaks it. It appears that the composite type is now picked up as a navigation property - this makes sense but find a way to make EFCore treat it as scalar?

Activity

  1. modified the milestone: 1.1.0 on Jul 1, 2016
  2. roji commented on Jul 30, 2016

    @roji
    MemberAuthor

    It's probably a good idea to wait and get some clarity on dotnet/efcore#246 before implementing this. Otherwise we may end up with something in Npgsql that isn't compatible with whatever the EF team decide to do with complex/value objects.

  3. roji commented on Oct 25, 2016

    @roji
    MemberAuthor

    Note: in addition to the actual mapping of the composite type, there's the question of support for creating the PostgreSQL type (i.e. CREATE TYPE).

  4. modified the milestones: 1.1.0, on Oct 25, 2016
  5. modified the milestones: 2.0.0, 2.1.0 on Jul 8, 2017
  6. xumix commented on Jan 31, 2018

    @xumix

    Looks like ef core has closed #246

  7. 59 remaining items

  8. roji commented on Nov 24, 2023

    @roji
    Author
  9. modified the milestones: 9.0.0, Backlog on Sep 13, 2024
  10. pm64 commented on Oct 20, 2024

    @pm64

    Hey @roji, I noticed this was moved from 9.0.0 to Backlog. Does that mean you're potentially planning it for 10.0?

    Huge fan, thanks for all you do.

  11. roji commented on Oct 20, 2024

    @roji
    MemberAuthor

    That mainly means that it's not going to happen for 9.0, not necessarily that it'll happen in 10. On the EF side, there are plans for improving the complex type mapping support, which may make the possible PG composite type support much better/more feasible.

  12. ZzZombo commented on Nov 22, 2024

    @ZzZombo

    What's the state of the feature currently? Do we have something to help testing? A quick search for "ComplexType" in the code reveals quite a lot of things, but it's unclear how finished they are.

    It's important for me because just the other day I was told on /dotnet/efcore that they are pushing to make complex types supersede owned types, and because I look forward to utilizing JSON columns instead of the many helper tables to store collections of owned (future complex) types.

  13. roji commented on Nov 22, 2024

    @roji
    MemberAuthor

    @ZzZombo this isn't implemented yet (open and in the backlog). But it's very important to understand what this is about: it's about allowing to map .NET POCOs to PostgreSQL composite types, which are a PostgreSQL-specific feature involving custom user-defined types in the database. Mapping .NET POCOs to JSON (on PostgreSQL and any other database) is tracked by dotnet/efcore#31252 on the EF side, and has nothing to do with this issue or PostgreSQL composite types (there are pros and cons of mapping to JSON vs. composite types - they're two different mapping strategieS).

    In any case, composite mapping is definitely something I want to do, but is far from trivial. However, the work on the EF side to enable complex type JSON mapping should provide some important infrastructure for doing composite mapping here as well.

  14. changed the title [-]Composite support[/-] [+]PostgreSQL composite type support[/+] on Dec 21, 2024
  15. added theissue type on Jun 14, 2025
  16. sergeidorodnov commented on Jul 8, 2025

    @sergeidorodnov

    I would like to know if support for composite types will be implemented? It has been more than 9 years since the first post in this thread.

  17. roji commented on Jul 9, 2025

    @roji
    MemberAuthor

    @sergeidorodnov as always with issues in the backlog, I can't say whether it will be implemented in the future or not. This issue hasn't exactly received a huge number of votes, it's quite complex to implement and there are many other competing priorities. That's really all I can say at the moment.

  18. Geosecure-Australia commented on Dec 3, 2025

    @Geosecure-Australia

    OMG. I spent hours trying to get this to work, and it can't! ARRRRGG!

  19. ctigrisht commented on Mar 21, 2026

    @ctigrisht

    @roji hey, I currently use raw sql for a project with a lot of denormalization and we decided to use composite types and arrays of composite types. We would have loved to be able to use ef core for this project

  20. roji commented on Mar 22, 2026

    @roji
    MemberAuthor

    FYI there are some changes planned on the EF side that should make composite support easier, but it will still be a while before this can happen.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions