This is the error message I'm seeing
PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block: SELECT 1 AS expression FROM {apachesolr_index_entities_file} apachesolr_index_entities_file WHERE ( (entity_type = :db_condition_placeholder_0) AND (entity_id = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => file [:db_condition_placeholder_1] => 27 ) in apachesolr_entity_update() (line 1881 of xxx/modules/apachesolr/apachesolr.module).
I also see that it is not able to insert into the table. Here is the error....
ERROR: null value in column "parent_entity_type" violates not-null constraint
Upon further investigation, I realized that the NOT NULL = false constraints on parent_entity_type and parent_entity_id are ignored by postgres since they are part of the Primary Key.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | postgres_issues-1864338-6.patch | 2.38 KB | moskito |
Comments
Comment #1
allartk commentedparent_entity_id should have a default value in the install file. I set it to 0, but did not review possible consequences yet :).
Comment #2
doru.furtuna commentedHi guys,
I have same issue with Oracle.
I think it should be fixed in next version.
Comment #3
moskito commentedIt is affecting 7.x-1.x-dev.
Set in 'apachesolr_index_entities_file' columns 'parent_entity_id' default to 0 and 'parent_entity_type' default to ''. Seems to be a workaround, but looking further in the code it seems to cause some side effects (e.g. wrong file usage count). Below goes a code where it might be a problem.
When a I try to uninstall this module in Postgres I also get this erro:
PDOException: SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying % unknown LINE 2: WHERE (name % 'apachesolr\\_attachments\\_enity\\_bundle\\_... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.: DELETE FROM {variable} WHERE (name % :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => apachesolr\_attachments\_enity\_bundle\_indexing\_ ) in apachesolr_attachments_uninstall() (line 26 of /var/www/html/drupal/sites/all/modules/apachesolr_attachments/apachesolr_attachments.install).This error seems to be a typo
where it should be:
I'll do some tests here and investigate it further.
Comment #4
moskito commentedSeems to me that this issue is caused by this MySQL peculiarity. As the document states, we are going to the wrong way to fix it.
Comment #5
moskito commentedComment #6
moskito commentedLooking it further, I found out that apachesolr module have to create a generic item in 'apachesolr_index_entities_file'. So, we have to provide a default value to 'parent_entity_id' and 'parent_entity_type' and it will make semantic sense. Doing some tests in mysql (version 5.1.29), I also found out that they were set then to 0 and '' as default before I use the patch.
In attached the patch that set in 'apachesolr_index_entities_file' columns 'parent_entity_id' default to 0 and 'parent_entity_type' default to ''. And fix 'apachesolr_attachments_uninstall' typo described in #3.
I did some tests in postgresql and mysql and seems to worked fine.
Comment #7
Teastwood commentedShouldn't it be "apachesolr_attachments_entity_bundle_indexing_" rather than "apachesolr_attachments_enity_bundle_indexing_", in the code given above ?
Comment #8
sumachaa commentedupdated patch/fix for this can be taken from https://www.drupal.org/project/apachesolr_attachments/issues/2677866