You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Supporting temporal data with WITHOUT OVERLAPS and PERIOD #2097
Is this still on your radar for 7.0? Temporal tables is a possible solution for something I'm working on, and frankly, I'd love to avoid needing to justify the financial and development time costs of trying to migrate from PG to SQL Server
It's unfortunately unlikely that I'll be able to do this for 7.0... One reason I'm a bit hesitant about doing this, is that it's unclear to what extent the above extension is up-to-date and the "final" temporal table support for PG; see notably this about possible movement for PG15. So it may be worth holding back on implementation until something more official makes it in.
However, it's probably possible to implement some scenarios with the temporal extension even without EF support - you may not actually need EF Core itself to know about temporal tables. Table creation can be managed with raw SQL in migrations (to add the temporal component), and as long as EF Core itself is used to query up-to-date date only, it doesn't need to be aware of the temporality. In other words, if the idea is for the application to access up-to-date data and use the temporal table as a manually-accessed audit or log, then things should be possible without any EF Core support.
@evman182 I understand, and I'm sorry there aren't better news on this at the moment. You should hopefully be able to get by with raw SQL in EF Core for the temporal syntax - remember you can use that for the basic temporal query and then compose other LINQ query operators on top.
@nk-cmd thanks. It's good to know that there's progress there, but I'm still reluctant to do the substantial work needed to support temporal tables on an unofficial extension etc.
@domagojmedo are you referring to the temporal_tables extension linked to above? If so, I have no idea (and that isn't really related to this repo in any way).
Yes, I understand it's not related to this repo. I was just following up on your comment that you won't do any work for unofficial extension (which is completely understandable).
I was just wondering if you maybe know if this feature is even in consideration to be implemented as official postgre feature
BenjamynWilliams-IconGroup commented on Jun 16, 2023
@BenjamynWilliams-IconGroup the situation hasn't really changed on the PG side - AFAIK there's no official temporal tables feature; see the comments above, they're all still valid.
Support for WITHOUT OVERLAPS and PERIOD has been implemented for version 11 - you'll be able to use it once the first 11 preview comes out, which should be quite soon; but if you want to try it out, please use the daily build (really simple to set up and very safe).
The support has been documented here, take a look and definitely comment if you have any feedback.
For now, I think that this "low level support" concludes the support in the EF provider. As written above, we could consider a high-level experience more akin to what SQL Server provides, but that would be a very different kind of feature, possibly beyond what an EF provider is supposed to provide (an extension could probably built on top of the low-level support introduced here to do that). FWIW I believe that the PG "first principles" approach of providing the lower-level primitives rather than a specific higher-level experience is the better way to build things like this, but it's clear that the full SQL Server-like "temporal table" (where applications just query/delete with the temporal stuff happening behind the scenes) is also very valuable.
Reacted by Erik O'Leary, Anton Egorov and Andrew Babbitt
Id assume some of the future expansions could be utilities like SQL Servers TemporalAll, TemporalBetween, and TemporalAsOf? Though this should be simpler to do in Postgres
@andrewbabbittdev PostgreSQL doesn't exactly have these concepts, but you should already be able to express the same things via regular range operations (which were already supported before this feature). For example, TemporalAsOf in SQL Server is the same as range.Contains(i) on the range column (see docs). It may make sense to explore a general cross-provider abstraction here, but it's most likely too early for that.
Activity
evman182 commentedon Jul 1, 2022
Is this still on your radar for 7.0? Temporal tables is a possible solution for something I'm working on, and frankly, I'd love to avoid needing to justify the financial and development time costs of trying to migrate from PG to SQL Server
roji commentedon Jul 2, 2022
It's unfortunately unlikely that I'll be able to do this for 7.0... One reason I'm a bit hesitant about doing this, is that it's unclear to what extent the above extension is up-to-date and the "final" temporal table support for PG; see notably this about possible movement for PG15. So it may be worth holding back on implementation until something more official makes it in.
However, it's probably possible to implement some scenarios with the temporal extension even without EF support - you may not actually need EF Core itself to know about temporal tables. Table creation can be managed with raw SQL in migrations (to add the temporal component), and as long as EF Core itself is used to query up-to-date date only, it doesn't need to be aware of the temporality. In other words, if the idea is for the application to access up-to-date data and use the temporal table as a manually-accessed audit or log, then things should be possible without any EF Core support.
evman182 commentedon Jul 3, 2022
I was reading the email thread about the PG patch a few days ago. Unfortunately it doesn't seem to be anywhere near getting merged.
Unfortunately the use case for which I'm looking to use temporal tables requires accessing them as part of the regular functions of the application.
roji commentedon Jul 3, 2022
@evman182 I understand, and I'm sorry there aren't better news on this at the moment. You should hopefully be able to get by with raw SQL in EF Core for the temporal syntax - remember you can use that for the basic temporal query and then compose other LINQ query operators on top.
ps-nk commentedon Apr 20, 2023
@roji Hi, there is an new Version of the extension available https://github.com/arkhipov/temporal_tables
roji commentedon Apr 20, 2023
@nk-cmd thanks. It's good to know that there's progress there, but I'm still reluctant to do the substantial work needed to support temporal tables on an unofficial extension etc.
domagojmedo commentedon Apr 20, 2023
Is there any issue to track for this becoming an official feature of postgre?
roji commentedon Apr 20, 2023
@domagojmedo are you referring to the temporal_tables extension linked to above? If so, I have no idea (and that isn't really related to this repo in any way).
domagojmedo commentedon Apr 20, 2023
Yes, I understand it's not related to this repo. I was just following up on your comment that you won't do any work for unofficial extension (which is completely understandable).
I was just wondering if you maybe know if this feature is even in consideration to be implemented as official postgre feature
BenjamynWilliams-IconGroup commentedon Jun 16, 2023
This hasn't seen an update in a few years, what's the update on this?
roji commentedon Jun 16, 2023
@BenjamynWilliams-IconGroup the situation hasn't really changed on the PG side - AFAIK there's no official temporal tables feature; see the comments above, they're all still valid.
12 remaining items
[-]Look into supporting temporal data[/-][+]Supporting temporal data with WITHOUT OVERLAPS and PERIOD[/+]Document temporal constraints
Document temporal constraints
Document temporal constraints (#444)
roji commentedon Jan 25, 2026
Support for WITHOUT OVERLAPS and PERIOD has been implemented for version 11 - you'll be able to use it once the first 11 preview comes out, which should be quite soon; but if you want to try it out, please use the daily build (really simple to set up and very safe).
The support has been documented here, take a look and definitely comment if you have any feedback.
For now, I think that this "low level support" concludes the support in the EF provider. As written above, we could consider a high-level experience more akin to what SQL Server provides, but that would be a very different kind of feature, possibly beyond what an EF provider is supposed to provide (an extension could probably built on top of the low-level support introduced here to do that). FWIW I believe that the PG "first principles" approach of providing the lower-level primitives rather than a specific higher-level experience is the better way to build things like this, but it's clear that the full SQL Server-like "temporal table" (where applications just query/delete with the temporal stuff happening behind the scenes) is also very valuable.
andrewbabbittdev commentedon Jan 26, 2026
Id assume some of the future expansions could be utilities like SQL Servers
TemporalAll,TemporalBetween, andTemporalAsOf? Though this should be simpler to do in Postgresroji commentedon Jan 27, 2026
@andrewbabbittdev PostgreSQL doesn't exactly have these concepts, but you should already be able to express the same things via regular range operations (which were already supported before this feature). For example, TemporalAsOf in SQL Server is the same as
range.Contains(i)on the range column (see docs). It may make sense to explore a general cross-provider abstraction here, but it's most likely too early for that.andrewbabbittdev commentedon Jan 27, 2026
Yeah no I knew we had ways to do it, but yes I was thinking more along the lines of what this looks like at a cross provider level :)
This is a fantastic start though and much earlier than I was expecting!
Additional work on temporal constraints
Additional work on temporal constraints (#3746)