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
Support WITHOUT OVERLAPS for primary keys and unique indexes on temporal tables #3708
WITHOUT OVERLAPS can only on a single column in the primary key, and only on the last. So we can effectively treat it as an option on the primary key, rather than on one of its columns.
One slight issue is that if we do this, it's up to the user to make sure that they list the range column as the last column in the constraint definition.
-- WorksCREATETABLEemployees (
emp_id INTEGER,
emp_name VARCHAR(100) NOT NULL,
valid_period tstzrange NOT NULL DEFAULT tstzrange(now(), 'infinity', '[)'),
PRIMARY KEY (emp_id, valid_period WITHOUT OVERLAPS)
);
-- Syntax error - not lastCREATETABLEemployees (
emp_id INTEGER,
emp_name VARCHAR(100) NOT NULL,
valid_period tstzrange NOT NULL DEFAULT tstzrange(now(), 'infinity', '[)'),
PRIMARY KEY (valid_period WITHOUT OVERLAPS, emp_id)
);
-- Syntax error - not last. Means also that you can have two WITHOUT OVERLAPS clausesCREATETABLEemployees (
emp_id INTEGER,
emp_name VARCHAR(100) NOT NULL,
valid_period tstzrange NOT NULL DEFAULT tstzrange(now(), 'infinity', '[)'),
valid_period2 tstzrange NOT NULL DEFAULT tstzrange(now(), 'infinity', '[)'),
PRIMARY KEY (emp_id, valid_period WITHOUT OVERLAPS, valid_period2 WITHOUT OVERLAPS)
);
Activity
roji commentedon Jan 23, 2026
WITHOUT OVERLAPS can only on a single column in the primary key, and only on the last. So we can effectively treat it as an option on the primary key, rather than on one of its columns.
One slight issue is that if we do this, it's up to the user to make sure that they list the range column as the last column in the constraint definition.
Implement support for PG18 WITHOUT OVERLAPS
[-]Support WITHOUT OVERLAPS[/-][+]Support WITHOUT OVERLAPS for primary keys and unique indexes on temporal tables[/+]Implement support for PG18 WITHOUT OVERLAPS
Implement support for PG18 WITHOUT OVERLAPS
Implement support for PG18 WITHOUT OVERLAPS
Implement support for PG18 WITHOUT OVERLAPS (npgsql#3709)