I am making a table as follows:
CREATE TABLE creator.lists
(
_id bigserial PRIMARY KEY NOT NULL,
account_id bigint NOT NULL,
created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
display_name text DEFAULT '',
name text DEFAULT '',
extra jsonb,
FOREIGN KEY (account_id)
REFERENCES creator.accounts (_id)
ON DELETE CASCADE
);
but I get this error:
ERROR: relation "account_id_index" already exists
When I run:
CREATE INDEX
account_id_index
ON
creator.lists
(
account_id
);
How do I create an index on the foreign key? I am running v11.1
Just a note, that I've also ran a similar command before for another table:
CREATE INDEX
account_id_index
ON
creator.contacts
(
account_id
);
I don't suppose that index names need to be unique between tables?