Search code examples
.netpostgresqlentity-frameworknpgsql

Constant tables in EF or Npgsql


PostgreSQL has a feature which allows defining constants tables in sql (https://www.postgresql.org/docs/12/queries-values.html). Such defined values can be used like a standard table (in joins etc.). I wonder if there is a way to do that in EF Core or at least in Npgsql directly?

The first use case that I can think of is using local enumerables of objects inside Linq's Join (but I think there would be quite a few ways to utilize the feature)


Solution

  • This currently isn't possible, but there may be some general EF Core improvements coming which would make this possible.

    Opened https://github.com/npgsql/efcore.pg/issues/2174 to track this, thanks.