4 ms·
I would prefer a generalized version of the "Oracle Flashback" feature: ability to add extra where conditions to a table, e.g. create table test (id int primar
by silvestrov 3y ago
I would prefer a generalized version of the "Oracle Flashback" feature: ability to add extra where conditions to a table, e.g.
create table test (id int primary key, attr int, deleted_at timestamp);
alter table test add default_filter is_active where deleted_at IS NULL;
then all selects like "select * from test where attr = 42" automatically gets added the above criteria and becomes "select * from test where attr = 42 AND deleted_at is NULL"
When you want old rows, you can override the default condition using something like:
select * from test where attr = 42 filter is_active (deleted_at IS NULL or deleted_at > '2010-01-01'::datetime)
You would then be able to have multiple criterias instead of just when row was deleted.