在一个旧版的PostgreSQL数据库中,我尝试使用以下命令删除一个已存在的索引:
DROP INDEX index_name;
However, I got an error message saying that the index does not exist. What am I doing wrong?
DROP INDEX testing.idx_testing_data_model_output_data_id;
并查看错误:
ERROR: index "<index name>" does not exist
但我可以使用\d <table name>
命令来查看索引:
leg=# \d testing.data_model
Table "testing.data_model"
Column | Type | Modifiers
----------------+-----------------------------+---------------------------------------------------------------------------
id | bigint | not null default nextval('testing.data_model_id_seq'::regclass)
input_data | text |
output_data_id | bigint |
Indexes:
"pk_testing_data_model" PRIMARY KEY, btree (id)
"idx_testing_data_model_output_data_id" btree (output_data_id)
好的,当我尝试创建索引时,出现了以下错误:
ERROR: relation "<index name>" already exists
看起来索引的创建或删除并没有成功完成。我该如何解决这个问题?
"testing"."idx_testing_data_model_output_data_id"
- 名称的每个元素必须单独加引号。 - user330315