当我尝试在表上创建索引时,我收到此错误消息。该表的架构如下所示:
CREATE TABLE object(
id int,
id_obj int,
id_parent int
)
所以,当我这样做时(在Python代码中):
cursor.execute('CREATE INDEX id_idx ON object(id)')
# or
cursor.execute('CREATE INDEX id_obj_idx ON object(id_obj)')
我收到以下错误消息:
psycopg2.ProgrammingError: relation "id_idx" already exists
# or
psycopg2.ProgrammingError: relation "id_obj_idx" already exists
这有什么问题?