Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL: What is meant by "please specify covering index name"

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:

picture of database table

The foreign keys:

foreign keys

category FK:

category FK

like image 477
NullOrNotNull Avatar asked Apr 26 '20 12:04

NullOrNotNull


People also ask

What is covering index in postgresql?

To make effective use of the index-only scan feature, you might choose to create a covering index, which is an index specifically designed to include the columns needed by a particular type of query that you run frequently.

How do I make a column editable in postgresql?

Select column, right click and choose Properties... option to open column editor. Alternatively select column in tree control and on Properties tab and open column editor with edit icon. In the editor update Comment field and confirm changes with Save button.


3 Answers

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.

like image 153
cYee Avatar answered Oct 07 '22 19:10

cYee


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

like image 44
Asad Avatar answered Oct 07 '22 18:10

Asad


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.

like image 6
jjanes Avatar answered Oct 07 '22 19:10

jjanes