Skip to content

Support primitive collections as JSON (instead of an array) #3122

Open
@roji

Description

@roji

The default - and natural - way to map a primitive collection (e.g. int[]) in PostgreSQL is to a database array (the PG integer[]) type. This is PG-unique feature; in other database, primitive collections are mapped to a JSON text column in the database.

However, in some cases it may still make sense to map primitive collections to JSON in PG, just like we do in other databases. While we seem to support the mapping itself, most forms of querying won't work (e.g. we need to translate to jsonb_to_recordset instead of unnest).

Since mapping to PG arrays is the recommended way, this isn't likely to be high priority. Putting this in the backlog to gather user feedback.

Note: one reason to do this would be to allow nested collections (once EF itself supports these in relational). PostgreSQL doesn't support arrays of arrays, so it's impossible to support nested collections when mapping to arrays; but JSON would work. Think about whether this should be automatic, or require some sort of opt in to make it clear that it's JSON rather than arrays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions