Omeka-S Reference module

Hello,

I have a problem when I click on an index (ex. : Provenance (dcterms-provenance)) :

Omeka S has encountered an error

Doctrine\ORM\Query\QueryException
[Syntax Error] line 0, col 7: Error: Expected known function, got ‘ANY_VALUE’

Détails :

Doctrine\ORM\Query\QueryException: SELECT ANY_VALUE(value.value) AS val, COUNT(DISTINCT resource.id) AS total, UPPER(SUBSTRING(value.value, 1, 1))AS initial, MIN(resource.id) AS first FROM Omeka\Entity\Value value INNER JOIN Omeka\Entity\Item resource WITH value.resource = resource WHERE value.property = :property AND value.value IS NOT NULL AND resource.id IN(SELECT omeka_root.id FROM Omeka\Entity\Item omeka_root) GROUP BY val ORDER BY val ASC in /applis/omeka/home/www/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:43

Does anyone have any ideas?

Thanks a lot.

1 Like

Hi,
It is related to your version of mysql/mariadb, that added a new parameter by default in the config.
What is the version of the module and database you use ? Normally, this issue was fixed in the last version (3.4.17), but I may have forgotten some check to determine any version.

Hi,

Thanks for your answer.

We use the last version v3.4.17 of this module.

Our version of mysql is v5.7.28-0 and our operating system is Ubuntu 18.04

Small supplement :

I launched that query on our database :
select any_value(name) from user group by name;

And it showed me a result without problem.
Therefore, the function exists and is active.

Yes it’s strange. You have the official mysql version, and there is a check for the function, so I can’t understand why it says it is not available here in the query . So it’s hard to understand. You may fix by reverting the fix in https://github.com/Daniel-KM/Omeka-S-module-Reference/blob/master/src/Mvc/Controller/Plugin/References.php#L471 :

! $this->supportAnyValue ? 'ANY_VALUE(value.value) AS val' : 'value.value AS val',

But I don’t know if it will work.

A better solution may be to replace the line with:

    'GROUP_CONCAT(DISTINCT value.value) AS val',

Could you tell me if it works on your server?
Normally, all values are the same, except for case sensitivity, that’s why it’s possible to choose any value or to select distinct values only.

We use a Mysql package on the official Ubuntu 18 repository.

It works with your first solution : ! $this->supportAnyValue ? ‘ANY_VALUE(value.value) AS val’ : ‘value.value AS val’,

but not with the second : ‘GROUP_CONCAT(DISTINCT value.value) AS val’,

The error is as follows:

Doctrine\DBAL\DriverException

An exception occurred while executing ‘SELECT GROUP_CONCAT(DISTINCT v0_.value) AS sclr_0, COUNT(DISTINCT r1_.id) AS sclr_1, UPPER(SUBSTRING(v0_.value FROM 1 FOR 1)) AS sclr_2, MIN(r1_.id) AS sclr_3 FROM value v0_ INNER JOIN (item i2_ INNER JOIN resource r1_ ON i2_.id = r1_.id) ON (v0_.resource_id = r1_.id) WHERE v0_.property_id = ? AND v0_.value IS NOT NULL AND r1_.id IN (SELECT r3_.id FROM item i4_ INNER JOIN resource r3_ ON i4_.id = r3_.id) GROUP BY sclr_0 ORDER BY sclr_0 ASC’ with params [51]: SQLSTATE [42000]: Syntax error or access violation: 1056 Can’t group on ‘sclr_0’.

Details :

PDOException: SQLSTATE [42000]: Syntax error or access violation: 1056 Can’t group on ‘sclr_0’ in /applis/omeka/home/wwww/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117

Ok, thanks. Anyway, it’s strange, since the function is checked before processing and on all other servers I checked it works. What is the url for ?

when I click on an index (ex. : Provenance (dcterms-provenance))

I finally find a way to reproduce it. It’s related to an outdated doctrine package. The version 3.4.18 of the module fixes it.

That’s great. I’ve installed version V3.4.18 and there’s no more problems.

Thank you very much for that.