Server: "access" column of "collres_accesscache" is bool in some places and integer in others, breaks w/psql

Created on 26 Apr 2019  路  10Comments  路  Source: nextcloud/server

Steps to reproduce

unsure, but:

1.) use nc16, php 7.3.4, postgresql 11
2.) look at logs


Title is based on going through the source code -- in migrations (core/Migrations/Version16000Date20190207141427.php) it seems the column is created with type integer but in lib/private/Collaboration/Resources/Manager.php it seems the code can't make up its mind about what type it should have-- some instances it specifies it should be a bool and in others integer (looking at types indicated to the querybuilder).

Previously some cast's were introduced -- if being consistent re:types in the source is not practical, perhaps normalizing it as stored in the database would work?

Expected behaviour

No errors with mismatched types to/from database.

Actual behaviour

errors and probably broken behavior.

Server configuration detail

Operating system: Linux 5.0.9 #1-NixOS SMP Sat Apr 20 07:17:05 UTC 2019 x86_64

Webserver: nginx/1.15.12 (fpm-fcgi)

Database: pgsql PostgreSQL 11.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.4.0, 64-bit

PHP version:

7.3.4
Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, gettext, gmp, SPL, iconv, session, intl, json, ldap, mbstring, standard, mysqlnd, pcntl, mysqli, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, Reflection, imap, SimpleXML, soap, sockets, sodium, exif, tokenizer, xml, xmlreader, xmlwriter, zip, cgi-fcgi, apcu, redis, imagick, Zend OPcache

Nextcloud version: 16.0.0 - 16.0.0.9

Updated from an older Nextcloud/ownCloud or fresh install: upgraded from 15.0.7

Where did you install Nextcloud from: nixpkgs, but for blame purposes let's say "manually" :)

Signing status

Array
(
)

List of activated apps

Enabled:
 - accessibility: 1.2.0
 - activity: 2.9.1
 - admin_audit: 1.6.0
 - calendar: 1.7.0
 - carnet: 0.15.2
 - cloud_federation_api: 0.2.0
 - comments: 1.6.0
 - contacts: 3.1.1
 - dav: 1.9.2
 - deck: 0.6.0
 - drawio: 0.9.3
 - event_update_notification: 0.3.4
 - federatedfilesharing: 1.6.0
 - federation: 1.6.0
 - files: 1.11.0
 - files_mindmap: 0.0.13
 - files_pdfviewer: 1.5.0
 - files_rightclick: 0.13.0
 - files_sharing: 1.8.0
 - files_texteditor: 2.8.0
 - files_trashbin: 1.6.0
 - files_versions: 1.9.0
 - files_videoplayer: 1.5.0
 - firstrunwizard: 2.5.0
 - gallery: 18.3.0
 - groupfolders: 3.0.0
 - issuetemplate: 0.5.0
 - logreader: 2.1.0
 - lookup_server_connector: 1.4.0
 - news: 13.1.6
 - nextcloud_announcements: 1.5.0
 - notes: 2.6.0
 - notifications: 2.4.1
 - oauth2: 1.4.2
 - password_policy: 1.6.0
 - polls: 0.10.2
 - privacy: 1.0.0
 - provisioning_api: 1.6.0
 - qownnotesapi: 19.4.0
 - serverinfo: 1.6.0
 - sharebymail: 1.6.0
 - socialsharing_email: 1.0.5
 - socialsharing_twitter: 1.0.4
 - support: 1.0.0
 - survey_client: 1.4.0
 - systemtags: 1.6.0
 - theming: 1.7.0
 - twofactor_backupcodes: 1.5.0
 - updatenotification: 1.6.0
 - viewer: 1.0.0
 - workflowengine: 1.6.0
Disabled:
 - announcementcenter
 - encryption
 - files_external
 - files_fulltextsearch
 - files_fulltextsearch_tesseract
 - recommendations
 - social
 - tasks
 - user_ldap

Configuration (config/config.php)

{
    "apps_paths": [
        {
            "path": "\/var\/lib\/nextcloud\/apps",
            "url": "\/apps",
            "writable": false
        },
        {
            "path": "\/var\/lib\/nextcloud\/store-apps",
            "url": "\/store-apps",
            "writable": true
        }
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "skeletondirectory": "",
    "memcache.local": "\\OC\\Memcache\\APCu",
    "log_type": "syslog",
    "log_level": "2",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "pgsql",
    "version": "16.0.0.9",
    "overwrite.cli.url": "http:\/\/localhost",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "loglevel": "2",
    "maintenance": false,
    "mail_smtpmode": "sendmail",
    "mail_sendmailmode": "smtp",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 0
    },
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "filelocking.enabled": "true",
    "has_rebuilt_cache": true,
    "data-fingerprint": "1ea395f55ba2b623d1f227e1fc0ce023",
    "app_install_overwrite": [
        "tasks",
        "qownnotesapi",
        "carnet",
        "admin_notifications"
    ],
    "trusted_domains": [
        "nextcloud.wdtz.org"
    ]
}

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption:

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

Client configuration

Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36

Operating system: NixOS (Linux)

Logs

Web server error log

2019-04-26 20:13:17.193 GMT [1871] ERROR:  invalid input syntax for integer: "t"
2019-04-26 20:13:17.193 GMT [1871] STATEMENT:  INSERT INTO "oc_collres_accesscache" ("user_id", "resource_id", "resource_type", "access") VALUES($1, $2, $3, $4)
Apr 26 15:13:17 HOSTNAME Nextcloud[1244]: {no app in context} {"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing 'INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)' with params [\"will\", \"240\", \"file\", true]:\n\nSQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: \"t\"","Code":0,"Trace":[{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php","line":184,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver","type":"->","args":["An exception occurred while executing 'INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)' with params [\"will\", \"240\", \"file\", true]:\n\nSQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: \"t\"",{"errorInfo":["22P02",7,"ERROR:  invalid input syntax for integer: \"t\""],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php","line":158,"function":"wrapException","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver"},{"errorInfo":["22P02",7,"ERROR:  invalid input syntax for integer: \"t\""],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"An exception occurred while executing 'INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)' with params [\"will\", \"240\", \"file\", true]:\n\nSQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: \"t\""]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php","line":1088,"function":"driverExceptionDuringQuery","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver"},{"errorInfo":["22P02",7,"ERROR:  invalid input syntax for integer: \"t\""],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)",{"1":"will","2":"240","3":"file","4":true}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/DB\/Connection.php","line":216,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)",["will","240","file",true],[2,2,2,5]]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php","line":222,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4)",{"dcValue1":"will","dcValue2":"240","dcValue3":"file","dcValue4":true},{"dcValue1":2,"dcValue2":2,"dcValue3":2,"dcValue4":5}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php","line":214,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Manager.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Manager.php","line":338,"function":"cacheAccessForResource","class":"OC\\Collaboration\\Resources\\Manager","type":"->","args":[{"__class__":"OC\\Collaboration\\Resources\\Resource"},{"__class__":"OC\\User\\User"},true]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Resource.php","line":118,"function":"canAccessResource","class":"OC\\Collaboration\\Resources\\Manager","type":"->","args":[{"__class__":"OC\\Collaboration\\Resources\\Resource"},{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Resource.php","line":108,"function":"canUserAccess","class":"OC\\Collaboration\\Resources\\Resource","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/core\/Controller\/CollaborationResourcesController.php","line":177,"function":"canAccess","class":"OC\\Collaboration\\Resources\\Resource","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"getCollectionsByResource","class":"OC\\Core\\Controller\\CollaborationResourcesController","type":"->","args":["file","240"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\CollaborationResourcesController"},"getCollectionsByResource"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/App.php","line":126,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\CollaborationResourcesController"},"getCollectionsByResource"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\CollaborationResourcesController","getCollectionsByResource",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/ocsapp\/collaboration\/resources\/file\/240"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v2.php","line":24,"args":["\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v1.php"],"function":"require_once"}],"File":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractPostgreSQLDriver.php","Line":99,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDOException","Message":"SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: \"t\"","Code":"22P02","Trace":[{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php","line":1079,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDOStatement","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/DB\/Connection.php","line":216,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)",["will","240","file",true],[2,2,2,5]]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php","line":222,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4)",{"dcValue1":"will","dcValue2":"240","dcValue3":"file","dcValue4":true},{"dcValue1":2,"dcValue2":2,"dcValue3":2,"dcValue4":5}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php","line":214,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Manager.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Manager.php","line":338,"function":"cacheAccessForResource","class":"OC\\Collaboration\\Resources\\Manager","type":"->","args":[{"__class__":"OC\\Collaboration\\Resources\\Resource"},{"__class__":"OC\\User\\User"},true]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Resource.php","line":118,"function":"canAccessResource","class":"OC\\Collaboration\\Resources\\Manager","type":"->","args":[{"__class__":"OC\\Collaboration\\Resources\\Resource"},{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Resource.php","line":108,"function":"canUserAccess","class":"OC\\Collaboration\\Resources\\Resource","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/core\/Controller\/CollaborationResourcesController.php","line":177,"function":"canAccess","class":"OC\\Collaboration\\Resources\\Resource","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"getCollectionsByResource","class":"OC\\Core\\Controller\\CollaborationResourcesController","type":"->","args":["file","240"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\CollaborationResourcesController"},"getCollectionsByResource"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/App.php","line":126,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\CollaborationResourcesController"},"getCollectionsByResource"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\CollaborationResourcesController","getCollectionsByResource",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/ocsapp\/collaboration\/resources\/file\/240"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v2.php","line":24,"args":["\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v1.php"],"function":"require_once"}],"File":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php","Line":143,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: \"t\"","Code":"22P02","Trace":[{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php","line":141,"function":"execute","class":"PDOStatement","type":"->","args":[null]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php","line":1079,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDOStatement","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/DB\/Connection.php","line":216,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(?, ?, ?, ?)",["will","240","file",true],[2,2,2,5]]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php","line":222,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO \"oc_collres_accesscache\" (\"user_id\", \"resource_id\", \"resource_type\", \"access\") VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4)",{"dcValue1":"will","dcValue2":"240","dcValue3":"file","dcValue4":true},{"dcValue1":2,"dcValue2":2,"dcValue3":2,"dcValue4":5}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php","line":214,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Manager.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Manager.php","line":338,"function":"cacheAccessForResource","class":"OC\\Collaboration\\Resources\\Manager","type":"->","args":[{"__class__":"OC\\Collaboration\\Resources\\Resource"},{"__class__":"OC\\User\\User"},true]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Resource.php","line":118,"function":"canAccessResource","class":"OC\\Collaboration\\Resources\\Manager","type":"->","args":[{"__class__":"OC\\Collaboration\\Resources\\Resource"},{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Collaboration\/Resources\/Resource.php","line":108,"function":"canUserAccess","class":"OC\\Collaboration\\Resources\\Resource","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/core\/Controller\/CollaborationResourcesController.php","line":177,"function":"canAccess","class":"OC\\Collaboration\\Resources\\Resource","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"getCollectionsByResource","class":"OC\\Core\\Controller\\CollaborationResourcesController","type":"->","args":["file","240"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\CollaborationResourcesController"},"getCollectionsByResource"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/App.php","line":126,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\CollaborationResourcesController"},"getCollectionsByResource"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\CollaborationResourcesController","getCollectionsByResource",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"resourceType":"file","resourceId":"240","_route":"ocs.core.CollaborationResources.getCollectionsByResource"}]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/ocsapp\/collaboration\/resources\/file\/240"]},{"file":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v2.php","line":24,"args":["\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/ocs\/v1.php"],"function":"require_once"}],"File":"\/nix\/store\/dm794k1gzkksccmyvhmvr5f8jbzqjj74-nextcloud-16.0.0\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php","Line":141}},"CustomMessage":"--"}

Nextcloud log

(see combined log above)

Browser log

0. Needs triage bug

Most helpful comment

Awesome, thank you for all your work on this!

All 10 comments

826821a7da6ad830e21d88459e147b0efe1013da forces type to IQueryBuilder::PARAM_BOOL which is inconsistent with usage in the same file -- for example: https://github.com/nextcloud/server/blob/826821a7da6ad830e21d88459e147b0efe1013da/lib/private/Collaboration/Resources/Manager.php#L142 .

The migration mentioned above is here: https://github.com/nextcloud/server/blob/v16.0.0/core/Migrations/Version16000Date20190207141427.php#L98 .

Hope this helps, thoughts/comments welcome :(.

I can't promise I'm not trading one bug for another, but reverting the linked commit ( https://github.com/nextcloud/server/commit/826821a7da6ad830e21d88459e147b0efe1013da ) fixes this for me!

Functionally, this seems to also resolve my inability to create projects (cc #15247), although can't say if there aren't other causes for this.

Please leave open until someone can investigate/confirm, and the fix is made for at least some stable branch. Thanks!

Thanks for your investigations @dtzWill. I am also facing this with nc16, php 7.3 and postgres. I also am unable to create projects.

Thank you for digging :+1:

https://github.com/nextcloud/server/blob/6781f9fc7652f735a75abd869ab3e79878fceec9/core/Migrations/Version16000Date20190207141427.php#L98

Type::SMALLINT should be Type::BOOLEAN.

MySQL uses a tinyint(1) to store a boolean value where PostgresSql has a dedicated type boolean for booleans. If we create a column with type smallint and try to save a boolean postgresql :boom:

https://github.com/doctrine/dbal/blob/e4978c2299d4d8e4f39da94f4d567e698e9bdbeb/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php#L944
https://github.com/doctrine/dbal/blob/e4978c2299d4d8e4f39da94f4d567e698e9bdbeb/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L299

@dtzWill @ttill If you restore the original code and change the column type in postgres does it work?

I would expect so-- I'll try redeploying with your PR which LGTM, and if migration doesn't auto-trigger (I don't know what handles this) I'll see about invoking via occ's migration-related commands which seems straightforward. Thanks for the PR and will report back in a bit :+1:.

EDIT: testing reports on the PR give me pause, taking a look...

https://drone.nextcloud.com/nextcloud/server/18035/21/5 build fails on postgres :disappointed:

I think I/we could put together the right SQL command to fix this directly (seems we need to tell postgresql how to do the conversion, which seems like `1 => true, 0 or otherwise -> false), but don't know where to begin re:convincing the migration bits to emit such a thing. Since it's a cache, maybe we could "migrate" by dropping the table entirely and recreating with the right schema? That sounds like a thing, maybe? :innocent:

Pushed a fix. Use changeColumn instead of dropColumn + addColumn. Doctrine has the logic (https://github.com/doctrine/dbal/blob/e4978c2299d4d8e4f39da94f4d567e698e9bdbeb/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php#L553) for this kind of conversion.

Awesome, thank you for all your work on this!

Thanks guys! Came here seeing the exact same issue in my logs recently on PostgreSQL 10.

Was this page helpful?
0 / 5 - 0 ratings