I wanted to edit the actions in a table. However I get the error message "Please specify covering index name." when I try to edit the FK. How do I fix this?
The table consists of only two columns:
The foreign keys:
category FK:
I wanted to edit the actions in a table. However I get the error message "Please specify covering index name." when I try to edit the FK. How do I fix this?
The table consists of only two columns:
The foreign keys:
category FK:
Temporary workaround: Using pgAdmin
If you have a single foreign key:
Click on edit to expand, and click on it again to collapse, save button should be re-enable again.
If you have multiple foreign keys:
Repeat on every foreign key entry, click edit and "un-edit" for every foreign key, the Save button should be re-enable after every one of it is clicked.
Usually, whenever the error pop up when I want to add anything to the constraint, I will just expand and collapse every foreign key, save button should be working again.
For action,
If you want to add an action, eg: On update/On delete
The error message will pop up again. Don't forget to click on the '+' button to add the column, then repeat above steps(expand, collapse) to clear the error message, then you can save the foreign key. Yeah~ I know it is ugly...
For updating action for existing foreign key
Currently, I don't know any workaround, but the ugly way...
Delete the fkey -> recreate the foreign-key -> update the action -> clear the error message with above steps -> save.
in our case this helped: before saving "new FK", firstly open "edit options" of "previously created FK", and DO NOT CHANGE anything then return to "newly created FK" edit options, save button magically activated
I can't reproduce your problem, as pgAdmin4 won't let me change anything about a constraint (other than its name) in the first place, so I can't get to the point where it would throw me an error like that. All the affordances to make changes are there, but they are all greyed out.
Also, PostgreSQL itself won't let you change an action on a FK constraint (there is simply no variant of "ALTER TABLE" which implements it), so you have to drop and recreate. So it is not surprising pgAdmin4 wont let me model such an action when it can't be done.
I don't know how you are getting it to produce this error, but it is probably a presentation bug in pgAdmin4, it is reporting an error condition as an error, but with a unhelpful message.
I had the same problem. It's really hard to reproduce it.
I needed to add several foreign keys. So I started to add new columns and new foreign keys. At some point, there was this error "Please specify covering index name." after every action in pgAdmin. Maybe I used an incorrect name for a column because I copypasted the names and there may be incorrect symbols, I don't know.
So to fix it I reverted all my updates: deleted all new foreign keys and new columns. And then this error disappeared.
As another solution I thought it is better to just write SQL queries to add some foreign keys.
What worked in my case - if you manually turn on "Validated?" option on the newly created foreign key and open "edit" on the previously created foreign key, then the message disappears and you can save the constraint. Seems like some kind of bug.
Here is my solution:
Table -> Property -> Constraints -> Foreign Key -> click delete icon for all foreign key.
Table -> Property -> Constraints -> Foreign Key -> Add again foreign key.
I guess you alter current FK or add new FK that causing this issue.
I had the same error. The problem was that a I had another foreign key with the same name in other table. I think postgres tracks the covering index and the name of the foreign key and don't allow the same name. So you have to use another name.
I just solved this, according to https://www.pgadmin.org/docs/pgadmin4/4.19/foreign_key_dialog.html the covering index warning is activated when the "Auto FK Index" is selected when creating the foreign key. This is enabled by default. I went through and unchecked it on each of the indexes on the table that was giving me the issue and the message went away.
The problem happened randomly for me. I just found that If I go to constraints -> primary key
tab and click the trash icon and then when confirming delete dialog comes I cancel it and boom, the error disappears and the save button is enabled!
just type the foreign key index name ... few letters fki_index_name (if you want an index generated "auto FK index" or turn it off!
And yes it looks like a bug in pgadmin not postgresql
PgAdmin has a browser at left side, select table and then go to Constraints, do a right click on the foreign key that you want to change, after that in properties you will be able to change it.
Try adding column using query tool:
ALTER TABLE x ADD COLUMN c INT NOT NULL
CONSTRAINT xy_fk_c REFERENCES y (a)
Where: x will be current table name, c will be column that you want to be created, xy_fk_c will be foreign key name, y will be the reference of your foreign table and a will be the referencing column.