Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLU-1] Database exception thrown when attempting to prune old records #70

Open
devinpitcher opened this issue Jun 9, 2022 · 3 comments
Assignees
Labels
bug linear Created by Linear-GitHub Sync

Comments

@devinpitcher
Copy link

devinpitcher commented Jun 9, 2022

When clicking the Prune old records button in the admin CP, I get the following error:

PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "datecreated" does not exist
LINE 3: WHERE dateCreated <= $1
              ^
HINT:  Perhaps you meant to reference the column "audit_log.dateCreated". in /app/craftcms/vendor/yiisoft/yii2/db/Command.php:1302
Stack trace:
#0 /app/craftcms/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute()
#1 /app/craftcms/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT COUNT(*)...')
#2 /app/craftcms/vendor/yiisoft/yii2/db/Command.php(436): yii\db\Command->queryInternal('fetchColumn', 0)
#3 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(497): yii\db\Command->queryScalar()
#4 /app/craftcms/vendor/yiisoft/yii2/db/ActiveQuery.php(352): yii\db\Query->queryScalar('COUNT(*)', Object(craft\db\Connection))
#5 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(368): yii\db\ActiveQuery->queryScalar('COUNT(*)', Object(craft\db\Connection))
#6 /app/craftcms/vendor/superbig/craft-audit/src/services/AuditService.php(500): yii\db\Query->count()
#7 /app/craftcms/vendor/superbig/craft-audit/src/controllers/DefaultController.php(98): superbig\audit\services\AuditService->pruneLogs()
#8 [internal function]: superbig\audit\controllers\DefaultController->actionPruneLogs()
#9 /app/craftcms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /app/craftcms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#11 /app/craftcms/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('prune-logs', Array)
#12 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction('audit/default/p...', Array)
#13 /app/craftcms/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('audit/default/p...', Array)
#14 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(278): yii\web\Application->handleRequest(Object(craft\web\Request))
#15 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#16 /app/craftcms/web/index.php(24): yii\base\Application->run()
#17 {main}

Next yii\db\Exception: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "datecreated" does not exist
LINE 3: WHERE dateCreated <= $1
              ^
HINT:  Perhaps you meant to reference the column "audit_log.dateCreated".
The SQL being executed was: SELECT COUNT(*)
FROM "audit_log"
WHERE dateCreated <= '2022-05-10 08:33:44' in /app/craftcms/vendor/yiisoft/yii2/db/Schema.php:676
Stack trace:
#0 /app/craftcms/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'SELECT COUNT(*)...')
#1 /app/craftcms/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT COUNT(*)...')
#2 /app/craftcms/vendor/yiisoft/yii2/db/Command.php(436): yii\db\Command->queryInternal('fetchColumn', 0)
#3 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(497): yii\db\Command->queryScalar()
#4 /app/craftcms/vendor/yiisoft/yii2/db/ActiveQuery.php(352): yii\db\Query->queryScalar('COUNT(*)', Object(craft\db\Connection))
#5 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(368): yii\db\ActiveQuery->queryScalar('COUNT(*)', Object(craft\db\Connection))
#6 /app/craftcms/vendor/superbig/craft-audit/src/services/AuditService.php(500): yii\db\Query->count()
#7 /app/craftcms/vendor/superbig/craft-audit/src/controllers/DefaultController.php(98): superbig\audit\services\AuditService->pruneLogs()
#8 [internal function]: superbig\audit\controllers\DefaultController->actionPruneLogs()
#9 /app/craftcms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /app/craftcms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#11 /app/craftcms/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('prune-logs', Array)
#12 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction('audit/default/p...', Array)
#13 /app/craftcms/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('audit/default/p...', Array)
#14 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(278): yii\web\Application->handleRequest(Object(craft\web\Request))
#15 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#16 /app/craftcms/web/index.php(24): yii\base\Application->run()
#17 {main}
Additional Information:
Array
(
    [0] => 42703
    [1] => 7
    [2] => ERROR:  column "datecreated" does not exist
LINE 3: WHERE dateCreated <= $1
              ^
HINT:  Perhaps you meant to reference the column "audit_log.dateCreated".
)

Plugin

Version 1.1.3

Application Info

PHP version                 8.0.10
OS version                  Linux 5.10.104-linuxkit
Database driver & version   PostgreSQL 13.2
Image driver & version      Imagick 3.5.1 (ImageMagick 7.0.11-13)
Craft edition & version     Craft Pro 3.7.44
Yii version                 2.0.45
Twig version                v2.14.13
Guzzle version              7.4.3

PLU-1

@sjelfull sjelfull self-assigned this Oct 3, 2022
@sjelfull
Copy link
Owner

sjelfull commented Oct 3, 2022

This might be a incompatibility with Postgres. I'll look into it.

@sjelfull sjelfull added the bug label Oct 3, 2022
@sjelfull sjelfull added the linear Created by Linear-GitHub Sync label Nov 21, 2023
@sjelfull sjelfull changed the title Database exception thrown when attempting to prune old records [PLU-1] Database exception thrown when attempting to prune old records Nov 21, 2023
@arskinner
Copy link

Hey @sjelfull I see this is still an issue -- is there a plan to fix it?

@sjelfull
Copy link
Owner

@arskinner There is, I just need to get around to setting up Postgres. I will try to find a quiet moment to this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

3 participants