Resolving mysql error Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': I'm getting the integrity constraint violation error (as shown below). There indeed exists a row in file_manage table with uri=''.

So my question is can I simply delete this row entry from the table without any side affects? Additionally how this empty row could have been added here.

Error Output when I do "drush cron":



WD node: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0,                     [error

:db_insert_placeholder_1, :db_insert_placeholder_2); Array
(
    [:db_insert_placeholder_0] => 0
    [:db_insert_placeholder_1] => 1
    [:db_insert_placeholder_2] => 1398243826
)
 in drupal_write_record() (line 7166 of D:\WORKAREA\work\htdocs\gij\includes\common.inc).



And here is the table row with empty uri:


mysql> select * from file_managed where uri='';
+------+-----+----------+-----+----------+----------+--------+------------+----------+
| fid  | uid | filename | uri | filemime | filesize | status | timestamp  | origname |
+------+-----+----------+-----+----------+----------+--------+------------+----------+
| 3356 |   0 |          |     |          |        0 |      1 | 1389353548 |          |
+------+-----+----------+-----+----------+----------+--------+------------+----------+
1 row in set (0.00 sec)
You can check whether the file is being used by another part of the system with the file_usage_list() function:

$file = file_load($fid);
$usage = file_usage_list($file);


If the returned array is empty, you can probably assume that it's an orphaned record, and safe to delete. But take a backup first, as always.