# Incorrect index name 'card\_value\_index'

**URL:** <https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960>\
**Category:** ℹ️ Support\
**Created:** [November 12, 2019, 2:22pm UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960 "2019-11-12T14:22:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aiko](https://help.nextcloud.com/user_avatar/help.nextcloud.com/aiko/32/16474_2.png) [@Aiko](https://help.nextcloud.com/u/Aiko)\
**Post date:** [November 12, 2019, 2:22pm UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/1 "2019-11-12T14:22:39Z")

</div>

> **Support intro**
>
> Sorry to hear you’re facing problems 🙁
> 
> _**[help.nextcloud.com](http://help.nextcloud.com) is for home/non-enterprise users. If you’re running a business, paid support can be accessed via [portal.nextcloud.com](http://portal.nextcloud.com) where we can ensure your business keeps running smoothly.**_
> 
> In order to help you as quickly as possible, before clicking **Create Topic** please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:
> 
> ```
> example
> 
> ```
> 
> Or for longer, use three backticks above and below the code snippet:
> 
> ```auto
> longer
> example
> here
> 
> ```
> 
> Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can ❤

Nextcloud version _(eg, 12.0.2)_: 16.0.6  
Operating system and version _(eg, Ubuntu 17.04)_: Centos 7  
Apache or nginx version _(eg, Apache 2.4.25)_: Apache/2.4.6  
PHP version _(eg, 7.1)_: PHP 7.2.20

The issue you are facing:  
After running “occ db:add-missing-indices” it returns

```
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Adding cards_prop_abid index to the cards_properties table, this can take some time...

In AbstractMySQLDriver.php line 125:

  An exception occurred while executing 'DROP INDEX idx_811f5cfa8b26c2e9 ON oc_cards_properties':

  SQLSTATE[42000]: Syntax error or access violation: 1280 Incorrect index name 'card_value_index'

In PDOConnection.php line 109:

  SQLSTATE[42000]: Syntax error or access violation: 1280 Incorrect index name 'card_value_index'

In PDOConnection.php line 107:

  SQLSTATE[42000]: Syntax error or access violation: 1280 Incorrect index name 'card_value_index'

db:add-missing-indices

```

Is this the first time you’ve seen this error? _(Y/N)_:  
No, it was there in the 16.0.5 version as well, since it didn’t cause much trouble I waited for the next update.

* * *

I already tried to truncate the **oc\_cards** and **oc\_cards\_properties** tables, this did not help. Any suggestions?

EDIT: In case it might be relevant, I’m trying to run “occ db:add-missing-indices”  
because **cards\_prop\_abid** seems to be missing.

FIX: [Incorrect index name 'card\_value\_index'](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/3)

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [November 12, 2019, 2:35pm UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/2 "2019-11-12T14:35:58Z")

</div>

```auto
... Incorrect index name 'card_value_index'

```

Most likely the index already exists for the database, so I wouldn’t classify this as an essential error, as long as all other things are ok. See

> <https://stackoverflow.com/questions/11918798/mysql-incorrect-index-name-error-unique-foreign-key>

It might help to see how a working table should look like (taken from my server):

```auto
> describe oc_cards_properties;
+---------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+----------------+
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| addressbookid | bigint(20) | NO | MUL | 0 | |
| cardid | bigint(20) unsigned | NO | MUL | 0 | |
| name | varchar(64) | YES | MUL | NULL | |
| value | varchar(255) | YES | MUL | NULL | |
| preferred | int(11) | NO | | 1 | |
+---------------+---------------------+------+-----+---------+----------------+

```

The indexes should look like this:

```auto
> show indexes from oc_cards_properties;
+---------------------+------------+----------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------------+------------+----------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| nc_cards_properties | 0 | PRIMARY | 1 | id | A | 8117 | NULL | NULL | | BTREE | | |
| nc_cards_properties | 1 | card_contactid_index | 1 | cardid | A | 2705 | NULL | NULL | | BTREE | | |
| nc_cards_properties | 1 | card_name_index | 1 | name | A | 30 | NULL | NULL | YES | BTREE | | |
| nc_cards_properties | 1 | card_value_index | 1 | value | A | 8117 | NULL | NULL | YES | BTREE | | |
| nc_cards_properties | 1 | cards_prop_abid | 1 | addressbookid | A | 16 | NULL | NULL | | BTREE | | |
+---------------------+------------+----------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

```

---

<div class="post-metadata">

**Author:** ![Aiko](https://help.nextcloud.com/user_avatar/help.nextcloud.com/aiko/32/16474_2.png) [@Aiko](https://help.nextcloud.com/u/Aiko)\
**Post date:** [November 12, 2019, 3:16pm UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/3 "2019-11-12T15:16:58Z")

</div>

Thank you for your insight! I’ve been looking into this for weeks. After your example I understood what went wrong, so I tried to drop the index:

```
MariaDB [******]> DROP INDEX idx_811f5cfa8b26c2e9 ON oc_cards_properties;

```

Which gave me this error:

```
ERROR 1280 (42000): Incorrect index name 'card_value_index'

```

So I dropped that one as well:

`DROP INDEX card_value_index ON oc_cards_properties;`

And there it went:

```
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0

```

With me finally being able to drop the other one:

```
MariaDB [******]> DROP INDEX idx_811f5cfa8b26c2e9 ON oc_cards_properties;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

```

After which  
`occ db:add-missing-indices`  
ran with no trouble at all:

```
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Adding cards_prop_abid index to the cards_properties table, this can take some time...
cards_properties table updated successfully.

```

Thank you so much!  
(also thanks for not hand feeding me a solution)

For future reference:  
I also initiated a filescan afterwards with

`occ files:scan --all`

---

<div class="post-metadata">

**Author:** ![Aiko](https://help.nextcloud.com/user_avatar/help.nextcloud.com/aiko/32/16474_2.png) [@Aiko](https://help.nextcloud.com/u/Aiko)\
**Post date:** [March 16, 2020, 11:45am UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/4 "2020-03-16T11:45:10Z")

</div>

Real glad I figured this out, with the most recent update I had to run:

> DROP INDEX calendarobject\_value\_index ON oc\_calendarobjects\_props;

because of:

> An exception occurred while executing ‘CREATE INDEX calendarobject\_calid\_index ON oc\_calendarobjects\_props (calendarid, calendartype)’:
> 
> SQLSTATE[42000]: Syntax error or access violation: 1280 Incorrect index name ‘calendarobject\_value\_index’

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 12:18pm UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/5 "2024-12-04T12:18:36Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [January 24, 2025, 8:15am UTC](https://help.nextcloud.com/t/incorrect-index-name-card-value-index/63960/6 "2025-01-24T08:15:41Z")

</div>


