EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
3.98k stars 1.01k forks source link

Search not working with POSTRGES #6269

Open Radio-Skonto opened 1 week ago

Radio-Skonto commented 1 week ago

Describe the bug Type anything in search. Result give error, because try to LOWER(id) which is integer

To Reproduce Postgres 15 or 16, Nginx, Symfony 7, EA4.9

   "require": {
        "php": ">=8.2",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/dbal": "^3",
        "doctrine/doctrine-bundle": "^2.11",
        "doctrine/doctrine-migrations-bundle": "^3.3",
        "doctrine/orm": "^3.1",
        "easycorp/easyadmin-bundle": "^4.9",
        "phpdocumentor/reflection-docblock": "^5.3",
        "phpstan/phpdoc-parser": "^1.26",
        "symfony/asset": "7.0.*",
        "symfony/asset-mapper": "7.0.*",
        "symfony/console": "7.0.*",
        "symfony/doctrine-messenger": "7.0.*",
        "symfony/dom-crawler": "7.0.*",
        "symfony/dotenv": "7.0.*",
        "symfony/expression-language": "7.0.*",
        "symfony/flex": "^2",
        "symfony/form": "7.0.*",
        "symfony/framework-bundle": "7.0.*",
        "symfony/http-client": "7.0.*",
        "symfony/intl": "7.0.*",
        "symfony/mailer": "7.0.*",
        "symfony/messenger": "7.0.*",
        "symfony/mime": "7.0.*",
        "symfony/monolog-bundle": "^3.0",
        "symfony/notifier": "7.0.*",
        "symfony/panther": "^2.1",
        "symfony/process": "7.0.*",
        "symfony/property-access": "7.0.*",
        "symfony/property-info": "7.0.*",
        "symfony/runtime": "7.0.*",
        "symfony/security-bundle": "7.0.*",
        "symfony/serializer": "7.0.*",
        "symfony/stimulus-bundle": "^2.16",
        "symfony/string": "7.0.*",
        "symfony/translation": "7.0.*",
        "symfony/twig-bundle": "7.0.*",
        "symfony/ux-turbo": "^2.16",
        "symfony/validator": "7.0.*",
        "symfony/web-link": "7.0.*",
        "symfony/yaml": "7.0.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*",
        "symfony/polyfill-php82": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "importmap:install": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "7.0.*"
        }
    },
    "require-dev": {
        "dbrekelmans/bdi": "^1.3",
        "doctrine/doctrine-fixtures-bundle": "^3.5",
        "phpunit/phpunit": "^9.5",
        "qossmic/deptrac-shim": "^1.0",
        "symfony/browser-kit": "7.0.*",
        "symfony/css-selector": "7.0.*",
        "symfony/debug-bundle": "7.0.*",
        "symfony/maker-bundle": "^1.56",
        "symfony/phpunit-bridge": "^7.0",
        "symfony/stopwatch": "7.0.*",
        "symfony/web-profiler-bundle": "7.0.*"
    }
}

(OPTIONAL) Additional context

Doctrine\DBAL\Exception\DriverException:
An exception occurred while executing a query: SQLSTATE[42883]: Undefined function: 7 ERROR:  function lower(integer) does not exist
LINE 1: ... id_0, s0_.id AS id_1 FROM song_artwork s0_ WHERE LOWER(s0_....
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

  at vendor/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php:87
  at Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(object(Exception), object(Query))
     (vendor/doctrine/dbal/src/Connection.php:1943)
  at Doctrine\DBAL\Connection->handleDriverException(object(Exception), object(Query))
     (vendor/doctrine/dbal/src/Connection.php:1885)
  at Doctrine\DBAL\Connection->convertExceptionDuringQuery(object(Exception), 'SELECT DISTINCT s0_.id AS id_0, s0_.id AS id_1 FROM song_artwork s0_ WHERE LOWER(s0_.id) LIKE ? OR LOWER(s0_.song_artist) LIKE ? OR LOWER(s0_.song_title) LIKE ? OR LOWER(s0_.song_album) LIKE ? OR LOWER(s0_.song_duration) LIKE ? OR LOWER(s0_.song_key) LIKE ? OR LOWER(s0_.song_loudness) LIKE ? OR LOWER(s0_.song_time_signature) LIKE ? OR LOWER(s0_.artwork_filename) LIKE ? OR LOWER(s0_.song_spotify_link) LIKE ? ORDER BY s0_.id DESC LIMIT 20', array('%sick%', '%sick%', '%sick%', '%sick%', '%sick%', '%sick%', '%sick%', '%sick%', '%sick%', '%sick%'), array(2, 2, 2, 2, 2, 2, 2, 2, 2, 2))
     (vendor/doctrine/dbal/src/Connection.php:1106)
ajgarlag commented 1 week ago

The issue was introduced in #6242

ajgarlag commented 1 week ago

There is a PR to solve the issue #6227

Radio-Skonto commented 1 week ago

@ajgarlag if i correct understand at this moment bug is not fixed and need downgrade version of EA to 4.8.*?

ajgarlag commented 1 week ago

@Radio-Skonto No need to downgrade to EA 4.8.* but to 4.9.4.

I've fixed it in my project adding a conflict in my composer.json file

{
    "require": {
        "easycorp/easyadmin-bundle": "^4"
    },
    "conflict": {
        "easycorp/easyadmin-bundle": "4.9.5"
    }
}
Radio-Skonto commented 1 week ago

@ajgarlag - Thank you very much for solution

Radio-Skonto commented 1 week ago

Solved

hellomedia commented 1 week ago

Would it be useful to keep this issue open until the fix is merged? If only for avoiding duplicate issues?