powerpaul17 / nc_money

Nextcloud app for finance management
GNU Affero General Public License v3.0
97 stars 9 forks source link

OC\DB\Exceptions\DbalException: An exception occurred while executing a query #16

Closed adicirstei closed 1 year ago

adicirstei commented 1 year ago

Hi @powerpaul17,

With the latest version of money 0.7.0 I get the below error:

I am using a postgresql database as part of nextcloud all-in one docker distribution.

[index] Error: OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[42883]: Undefined function: 7 ERROR:  function year(date) does not exist
LINE 1: SELECT "a".*, YEAR(c.date) AS "year", MONTH(c.date) AS "mont...
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts. at <<closure>>

0. /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php line 296
   OC\DB\Exceptions\DbalException::wrap(Doctrine\DBAL\Ex ... {})
1. /var/www/html/custom_apps/money/lib/Controller/AccountController.php line 44
   OC\DB\QueryBuilder\QueryBuilder->executeQuery()
2. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 225
   OCA\Money\Controller\AccountController->getAccounts()
3. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 133
   OC\AppFramework\Http\Dispatcher->executeController(OCA\Money\Controller\AccountController {}, "getAccounts")
4. /var/www/html/lib/private/AppFramework/App.php line 172
   OC\AppFramework\Http\Dispatcher->dispatch(OCA\Money\Controller\AccountController {}, "getAccounts")
5. /var/www/html/lib/private/Route/Router.php line 298
   OC\AppFramework\App::main("OCA\\Money\\Con ... r", "getAccounts", OC\AppFramework\ ... {}, ["money.account.get_accounts"])
6. /var/www/html/lib/base.php line 1030
   OC\Route\Router->match("/apps/money/accounts")
7. /var/www/html/index.php line 36
   OC::handleRequest()

GET /apps/money/accounts
from [ipaddress] by admin at 2022-10-21T14:18:56+00:00
powerpaul17 commented 1 year ago

Apparently the year (and probably month) functions do not exist on PostgreSQL.. 😔

I'll try to replace them and release a fix..

powerpaul17 commented 1 year ago

Fixed in 165c2a0262afc8bd2a744d8fba0384f865087cf5