-- match partial not implemented yet
create table t (
  a int,
  b int references foo.bar ( bar ) match partial
    on delete no action
    on update set null ( a, b )
);


-- temporal_foreign_key
CREATE TABLE orders (
    id int8 generated BY DEFAULT AS IDENTITY,
    address_id int8 NOT NULL,
    address_valid_at tstzrange NOT NULL,
    content text,
    CONSTRAINT order_address FOREIGN KEY ( address_id, PERIOD address_valid_at ) REFERENCES addresses ( id, PERIOD valid_range )
);

-- unique_constraint_without_overlaps
create table t (
  a int,
  b text,
  unique (a without overlaps)
);


-- primary key without overlaps
create table t (
    a text,
    b text,
    c text,
    constraint pk 
        primary key (a, b, c without overlaps)
);

-- temporal_primary_key
CREATE TABLE addresses (
    id int8 generated BY DEFAULT AS IDENTITY,
    valid_range tstzrange NOT NULL DEFAULT tstzrange(now(), 'infinity', '[)'),
    recipient text NOT NULL,
    PRIMARY KEY (id, valid_range WITHOUT OVERLAPS)
);
