partkeepr / PartKeepr

Open Source Inventory Management
http://www.partkeepr.org
GNU General Public License v3.0
1.38k stars 401 forks source link

Partkeepr 0.78 installation / PostgreSQL: Check for existing user fails (Undefined function: 7 ERROR: operator does not exist: boolean = integer\nLINE 1: ...0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1) #575

Closed trial-n-error closed 8 years ago

trial-n-error commented 8 years ago

Hi,

when using the web-based installation routine with a postgresql database backend on a fresh OR existing database installation, the check for existing user fails.

Relevant error messages from setup_test.log:

[2016-01-18 13:45:23] doctrine.DEBUG: SELECT COUNT(p0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1 [] []
[2016-01-18 13:45:23] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred while executing 'SELECT COUNT(p0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1':  SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer LINE 1: ...0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1                                                                     ^ HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts." at /srv/http/parts.trial-n-error.net/partkeepr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 91 {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 0): An exception occurred while executing 'SELECT COUNT(p0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1':\n\nSQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer\nLINE 1: ...0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1\n                                                                    ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts. at /srv/http/parts.trial-n-error.net/partkeepr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php:91, Doctrine\\DBAL\\Driver\\PDOException(code: 42883): SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer\nLINE 1: ...0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1\n                                                                    ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts. at /srv/http/parts.trial-n-error.net/partkeepr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:106, PDOException(code: 42883): SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer\nLINE 1: ...0_.id) AS sclr_0 FROM PartKeeprUser p0_ WHERE p0_.legacy = 1\n                                                                    ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts. at /srv/http/parts.trial-n-error.net/partkeepr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:104)"} []

Environment:

Workaround: Apply the following patch:

--- partkeepr/src/PartKeepr/SetupBundle/Controller/ExistingUserSetupController.php.orig 2016-01-11 18:42:40.000000000 +0100
+++ partkeepr/src/PartKeepr/SetupBundle/Controller/ExistingUserSetupController.php      2016-01-18 13:48:01.872935201 +0100
@@ -28,7 +28,7 @@
     {
         $repository = $this->getDoctrine()->getRepository("PartKeeprAuthBundle:User");

-        $legacyUsersDQL = "SELECT COUNT(u) FROM PartKeepr\AuthBundle\Entity\User u WHERE u.legacy = 1";
+        $legacyUsersDQL = "SELECT COUNT(u) FROM PartKeepr\AuthBundle\Entity\User u WHERE u.legacy = true";

         $legacyUsersQuery = $this->get("doctrine.orm.default_entity_manager")->createQuery($legacyUsersDQL);
Drachenkaetzchen commented 8 years ago

Thanks for the find and fix.

Needs to be covered by unit / functional tests.

Drachenkaetzchen commented 8 years ago

This is now fixed.