nextcloud / tables

🍱 Nextcloud tables app
https://apps.nextcloud.com/apps/tables
GNU Affero General Public License v3.0
148 stars 23 forks source link

Error reading rows: UNION types text and double precision cannot be matched #849

Closed blizzz closed 9 months ago

blizzz commented 9 months ago

Steps to reproduce

  1. Use Postgres
  2. Run Tables from main
  3. Open a Table

Expected behavior

All rows are being loaded

Actual behavior

An unknown error is reported in the user interface, the server logs state `UNION types text and double precision cannot be matched` ```json { "reqId": "S3cSR6uHhey9iuaiAbvZ", "level": 3, "time": "2024-02-15T18:10:59+00:00", "remoteAddr": "127.0.0.1", "user": "master", "app": "tables", "method": "GET", "url": "/master/index.php/apps/tables/row/table/10", "message": "An exception occurred while executing a query: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^", "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0", "version": "29.0.0.5", "exception": { "Exception": "OC\\DB\\Exceptions\\DbalException", "Message": "An exception occurred while executing a query: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^", "Code": 7, "Trace": [ { "file": "/srv/http/nextcloud/master/lib/private/DB/ConnectionAdapter.php", "line": 72, "function": "wrap", "class": "OC\\DB\\Exceptions\\DbalException", "type": "::", "args": [ [ "Doctrine\\DBAL\\Exception\\DriverException" ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 214, "function": "executeQuery", "class": "OC\\DB\\ConnectionAdapter", "type": "->", "args": [ "SELECT `row_id`, `column_id`, `created_by`, `created_at`, `t1`.`last_edit_by`, `t1`.`last_edit_at`, `value`, `table_id` FROM (SELECT * FROM `*PREFIX*tables_row_cells_text` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_number` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_datetime` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_selection` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) ) `t1` INNER JOIN `*PREFIX*tables_row_sleeves` `rowSleeve` ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 181, "function": "getRows", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Service/RowService.php", "line": 66, "function": "findAll", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [], 10, null, null, null, null, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 39, "function": "findAllByTable", "class": "OCA\\Tables\\Service\\RowService", "type": "->", "args": [ 10, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/Errors.php", "line": 16, "function": "OCA\\Tables\\Controller\\{closure}", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 38, "function": "handleError", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ [ "Closure" ] ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 232, "function": "index", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ 10 ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 138, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/App.php", "line": 184, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/Route/Router.php", "line": 315, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OCA\\Tables\\Controller\\RowController", "index", [ "OC\\AppFramework\\DependencyInjection\\DIContainer" ], [ "10", "tables.row.index" ] ] }, { "file": "/srv/http/nextcloud/master/lib/base.php", "line": 1059, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/apps/tables/row/table/10" ] }, { "file": "/srv/http/nextcloud/master/index.php", "line": 49, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/srv/http/nextcloud/master/lib/private/DB/Exceptions/DbalException.php", "Line": 71, "Previous": { "Exception": "Doctrine\\DBAL\\Exception\\DriverException", "Message": "An exception occurred while executing a query: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^", "Code": 7, "Trace": [ { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Connection.php", "line": 1938, "function": "convert", "class": "Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter", "type": "->", "args": [ [ "Doctrine\\DBAL\\Driver\\PDO\\Exception" ], [ "Doctrine\\DBAL\\Query" ] ] }, { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Connection.php", "line": 1880, "function": "handleDriverException", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ [ "Doctrine\\DBAL\\Driver\\PDO\\Exception" ], [ "Doctrine\\DBAL\\Query" ] ] }, { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Connection.php", "line": 1105, "function": "convertExceptionDuringQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ [ "Doctrine\\DBAL\\Driver\\PDO\\Exception" ], "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [], [] ] }, { "file": "/srv/http/nextcloud/master/lib/private/DB/Connection.php", "line": 298, "function": "executeQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [], [], null ] }, { "file": "/srv/http/nextcloud/master/lib/private/DB/ConnectionAdapter.php", "line": 69, "function": "executeQuery", "class": "OC\\DB\\Connection", "type": "->", "args": [ "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 214, "function": "executeQuery", "class": "OC\\DB\\ConnectionAdapter", "type": "->", "args": [ "SELECT `row_id`, `column_id`, `created_by`, `created_at`, `t1`.`last_edit_by`, `t1`.`last_edit_at`, `value`, `table_id` FROM (SELECT * FROM `*PREFIX*tables_row_cells_text` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_number` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_datetime` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_selection` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) ) `t1` INNER JOIN `*PREFIX*tables_row_sleeves` `rowSleeve` ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 181, "function": "getRows", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Service/RowService.php", "line": 66, "function": "findAll", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [], 10, null, null, null, null, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 39, "function": "findAllByTable", "class": "OCA\\Tables\\Service\\RowService", "type": "->", "args": [ 10, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/Errors.php", "line": 16, "function": "OCA\\Tables\\Controller\\{closure}", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 38, "function": "handleError", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ [ "Closure" ] ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 232, "function": "index", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ 10 ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 138, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/App.php", "line": 184, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/Route/Router.php", "line": 315, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OCA\\Tables\\Controller\\RowController", "index", [ "OC\\AppFramework\\DependencyInjection\\DIContainer" ], [ "10", "tables.row.index" ] ] }, { "file": "/srv/http/nextcloud/master/lib/base.php", "line": 1059, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/apps/tables/row/table/10" ] }, { "file": "/srv/http/nextcloud/master/index.php", "line": 49, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php", "Line": 87, "Previous": { "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception", "Message": "SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^", "Code": 7, "Trace": [ { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "line": 132, "function": "new", "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception", "type": "::", "args": [ [ "PDOException", [ "42804", 7, "ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^" ] ] ] }, { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Connection.php", "line": 1098, "function": "execute", "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement", "type": "->", "args": [] }, { "file": "/srv/http/nextcloud/master/lib/private/DB/Connection.php", "line": 298, "function": "executeQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [], [], null ] }, { "file": "/srv/http/nextcloud/master/lib/private/DB/ConnectionAdapter.php", "line": 69, "function": "executeQuery", "class": "OC\\DB\\Connection", "type": "->", "args": [ "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 214, "function": "executeQuery", "class": "OC\\DB\\ConnectionAdapter", "type": "->", "args": [ "SELECT `row_id`, `column_id`, `created_by`, `created_at`, `t1`.`last_edit_by`, `t1`.`last_edit_at`, `value`, `table_id` FROM (SELECT * FROM `*PREFIX*tables_row_cells_text` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_number` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_datetime` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_selection` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) ) `t1` INNER JOIN `*PREFIX*tables_row_sleeves` `rowSleeve` ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 181, "function": "getRows", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Service/RowService.php", "line": 66, "function": "findAll", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [], 10, null, null, null, null, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 39, "function": "findAllByTable", "class": "OCA\\Tables\\Service\\RowService", "type": "->", "args": [ 10, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/Errors.php", "line": 16, "function": "OCA\\Tables\\Controller\\{closure}", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 38, "function": "handleError", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ [ "Closure" ] ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 232, "function": "index", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ 10 ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 138, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/App.php", "line": 184, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/Route/Router.php", "line": 315, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OCA\\Tables\\Controller\\RowController", "index", [ "OC\\AppFramework\\DependencyInjection\\DIContainer" ], [ "10", "tables.row.index" ] ] }, { "file": "/srv/http/nextcloud/master/lib/base.php", "line": 1059, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/apps/tables/row/table/10" ] }, { "file": "/srv/http/nextcloud/master/index.php", "line": 49, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php", "Line": 28, "Previous": { "Exception": "PDOException", "Message": "SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^", "Code": "42804", "Trace": [ { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "line": 130, "function": "execute", "class": "PDOStatement", "type": "->", "args": [ null ] }, { "file": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Connection.php", "line": 1098, "function": "execute", "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement", "type": "->", "args": [] }, { "file": "/srv/http/nextcloud/master/lib/private/DB/Connection.php", "line": 298, "function": "executeQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (NULL)) AND (\"row_id\" IN (NULL)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [], [], null ] }, { "file": "/srv/http/nextcloud/master/lib/private/DB/ConnectionAdapter.php", "line": 69, "function": "executeQuery", "class": "OC\\DB\\Connection", "type": "->", "args": [ "SELECT \"row_id\", \"column_id\", \"created_by\", \"created_at\", \"t1\".\"last_edit_by\", \"t1\".\"last_edit_at\", \"value\", \"table_id\" FROM (SELECT * FROM \"oc_tables_row_cells_text\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_number\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_datetime\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) UNION ALL SELECT * FROM \"oc_tables_row_cells_selection\" WHERE (\"column_id\" IN (:columnIds)) AND (\"row_id\" IN (:rowsIds)) ) \"t1\" INNER JOIN \"oc_tables_row_sleeves\" \"rowSleeve\" ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 214, "function": "executeQuery", "class": "OC\\DB\\ConnectionAdapter", "type": "->", "args": [ "SELECT `row_id`, `column_id`, `created_by`, `created_at`, `t1`.`last_edit_by`, `t1`.`last_edit_at`, `value`, `table_id` FROM (SELECT * FROM `*PREFIX*tables_row_cells_text` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_number` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_datetime` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) UNION ALL SELECT * FROM `*PREFIX*tables_row_cells_selection` WHERE (`column_id` IN (:columnIds)) AND (`row_id` IN (:rowsIds)) ) `t1` INNER JOIN `*PREFIX*tables_row_sleeves` `rowSleeve` ON rowSleeve.id = t1.row_id", [ [], [] ], [ 101, 101 ] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Db/Row2Mapper.php", "line": 181, "function": "getRows", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [] ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Service/RowService.php", "line": 66, "function": "findAll", "class": "OCA\\Tables\\Db\\Row2Mapper", "type": "->", "args": [ [], [], 10, null, null, null, null, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 39, "function": "findAllByTable", "class": "OCA\\Tables\\Service\\RowService", "type": "->", "args": [ 10, "master" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/Errors.php", "line": 16, "function": "OCA\\Tables\\Controller\\{closure}", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/srv/http/nextcloud/master/apps-repos/tables/lib/Controller/RowController.php", "line": 38, "function": "handleError", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ [ "Closure" ] ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 232, "function": "index", "class": "OCA\\Tables\\Controller\\RowController", "type": "->", "args": [ 10 ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/Http/Dispatcher.php", "line": 138, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/AppFramework/App.php", "line": 184, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ [ "OCA\\Tables\\Controller\\RowController" ], "index" ] }, { "file": "/srv/http/nextcloud/master/lib/private/Route/Router.php", "line": 315, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OCA\\Tables\\Controller\\RowController", "index", [ "OC\\AppFramework\\DependencyInjection\\DIContainer" ], [ "10", "tables.row.index" ] ] }, { "file": "/srv/http/nextcloud/master/lib/base.php", "line": 1059, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/apps/tables/row/table/10" ] }, { "file": "/srv/http/nextcloud/master/index.php", "line": 49, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/srv/http/nextcloud/master/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "Line": 130 } } }, "message": "An exception occurred while executing a query: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^", "exception": {}, "CustomMessage": "An exception occurred while executing a query: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: UNION types text and double precision cannot be matched\nLINE 1: ...(NULL)) AND (\"row_id\" IN (NULL)) UNION ALL SELECT * FROM \"oc...\n ^" } } ```

Tables app version

main

Browser

No response

Client operating system

No response

Operating system

Arch Linux

Web server

Apache

PHP engine version

Other

Database

PostgreSQL

Additional info

No response

blizzz commented 9 months ago

fyi @juliushaertl potential blocker

juliusknorr commented 9 months ago

Hm, I thought that this was covered by integration tests.

Nevertheless a quick fix could be to just cast to text:

diff --git a/lib/Db/Row2Mapper.php b/lib/Db/Row2Mapper.php
index 474e0c0d..97e27ec8 100644
--- a/lib/Db/Row2Mapper.php
+++ b/lib/Db/Row2Mapper.php
@@ -193,7 +193,7 @@ class Row2Mapper {
                $qbSqlForColumnTypes = null;
                foreach ($this->columnsHelper->columns as $columnType) {
                        $qbTmp = $this->db->getQueryBuilder();
-                       $qbTmp->select('*')
+                       $qbTmp->select('row_id', 'column_id', 'last_edit_at', 'last_edit_by', $qb->expr()->castColumn('value', IQueryBuilder::PARAM_STR))
                                ->from('tables_row_cells_'.$columnType)
                                ->where($qb->expr()->in('column_id', $qb->createNamedParameter($columnIds, IQueryBuilder::PARAM_INT_ARRAY, ':columnIds')))
                                ->andWhere($qb->expr()->in('row_id', $qb->createNamedParameter($rowIds, IQueryBuilder::PARAM_INT_ARRAY, ':rowsIds')));
@@ -208,7 +208,7 @@ class Row2Mapper {

                $qb->select('row_id', 'column_id', 'created_by', 'created_at', 't1.last_edit_by', 't1.last_edit_at', 'value', 'table_id')
                        ->from($qb->createFunction($qbSqlForColumnTypes), 't1')
-                       ->innerJoin('t1', 'tables_row_sleeves', 'rowSleeve', 'rowSleeve.id = t1.row_id');
+                       ->innerJoin('t1', 'tables_row_sleeves', 'rs', 'rs.id = t1.row_id');

                try {
                        $result = $this->db->executeQuery($qb->getSQL(), $qb->getParameters(), $qb->getParameterTypes());

Though I'm not sure if we just want to split up the queries or at least have a dedicated select alias for each type.