npgsql / efcore.pg

Entity Framework Core provider for PostgreSQL
PostgreSQL License
1.52k stars 223 forks source link

Stored vs. calculated generated columns #946

Open roji opened 5 years ago

roji commented 5 years ago

At this point PostgreSQL only supports stored generated columns (persisted to disk). I can see in various places that the plan is to add computed/virtual columns (which get calculated on the fly with each query).

Hopefully calculated columns make it into PG 12 as well - this issue tracks adding support for those. Otherwise we'll need to think about defaults: although SQL Server supports both persisted and non-persisted generated columns, the EF Core provider only creates the non-persisted variety. I'll try to see with the EF team how they want to handle it, but we may need to introduce metadata to distinguish between the two kinds of generated columns, and possibly force users to manually request stored on PostgreSQL (assuming we want to align with SQL Server on non-stored being the default).

Anyway, let's wait and see what happens.

roji commented 5 years ago

/cc @divega @ajcvickers