Reputation: 4661
I'm unable to create an excludes index with this schema.
create table foo_bar(
foo_id text primary key,
bar char(3) not null,
created_at timestamptz not null default current_timestamp,
system_period tstzrange not null default tstzrange(current_timestamp, null),
exclude using gist (system_period with &&)
);
create table foo_bar_history(like foo_bar);
alter table foo_bar_history add constraint exclude using gist (system_period with &&);
The final alter table line here fails with
SQL Error [42601]: ERROR: syntax error at or near "using"
I've double checked the docs, but I really can't see what I'm doing wrong here.
PostgreSQL 9.6.9 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0, 64-bit
Upvotes: 0
Views: 182
Reputation: 246308
You either have to specify the constraint name after CONSTRAINT
or omit that keyword altogether so that PostgreSQL picks a name itself.
Upvotes: 1