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

Column not found Error when saving plugin settings #3

Closed
raygers opened this issue Feb 19, 2019 · 9 comments
Closed

Column not found Error when saving plugin settings #3

raygers opened this issue Feb 19, 2019 · 9 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@raygers
Copy link

raygers commented Feb 19, 2019

Hi

Get the below error while trying to save the settings from within the plugin settings in CP. I had to revert to using the config file to configure the plugin.

Using Craft Pro 3.1.8

Exception:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'craft_elements.id' in 'field list' in /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php:1258
Stack trace:
#0 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php(1258): PDOStatement->execute()
#1 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php(1148): yii\db\Command->internalExecute('SELECT `craft_e...')
#2 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php(399): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Query.php(237): yii\db\Command->queryAll()
#4 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/db/Query.php(161): yii\db\Query->all(NULL)
#5 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1200): craft\db\Query->all(NULL)
#6 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/la-haute-societe/craft-elasticsearch/src/services/Elasticsearch.php(489): craft\elements\db\ElementQuery->all()
#7 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/la-haute-societe/craft-elasticsearch/src/Elasticsearch.php(336): lhs\elasticsearch\services\Elasticsearch->getEnabledEntries()
#8 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/la-haute-societe/craft-elasticsearch/src/Elasticsearch.php(111): lhs\elasticsearch\Elasticsearch->onPluginSettingsSaved()
#9 [internal function]: lhs\elasticsearch\Elasticsearch->lhs\elasticsearch{closure}(Object(craft\events\PluginEvent))
#10 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Event.php(310): call_user_func(Object(Closure), Object(craft\events\PluginEvent))
#11 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\services\...', 'afterSavePlugin...', Object(craft\events\PluginEvent))
#12 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/services/Plugins.php(702): yii\base\Component->trigger('afterSavePlugin...', Object(craft\events\PluginEvent))
#13 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/controllers/PluginsController.php(171): craft\services\Plugins->savePluginSettings(Object(lhs\elasticsearch\Elasticsearch), Array)
#14 [internal function]: craft\controllers\PluginsController->actionSavePluginSettings()
#15 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#16 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#17 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('save-plugin-set...', Array)
#18 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-plugin-set...', Array)
#19 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('plugins/save-pl...', Array)
#20 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Application.php(561): craft\web\Application->runAction('plugins/save-pl...', Array)
#21 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#22 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#23 /Users/raygerstner/GitRespositories/mweb_web_craftcms/web/index.php(21): yii\base\Application->run()
#24 {main}

Next yii\db\Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'craft_elements.id' in 'field list'
The SQL being executed was: SELECT craft_elements.id AS entryId, craft_elements_sites.siteId
FROM (SELECT elements.id AS elementsId, elements_sites.id AS elementsSitesId, content.id AS contentId
FROM craft_elements elements
INNER JOIN craft_entries entries ON entries.id = elements.id
INNER JOIN craft_elements_sites elements_sites ON elements_sites.elementId = elements.id
INNER JOIN craft_content content ON content.elementId = elements.id
LEFT JOIN craft_structureelements structureelements ON structureelements.elementId = elements.id
WHERE (elements_sites.siteId=1) AND (content.siteId=1) AND (elements.archived=FALSE) AND (((elements.enabled=TRUE) AND (elements_sites.enabled=TRUE)) AND (entries.postDate <= '2019-02-19 10:44:40') AND ((entries.expiryDate IS NULL) OR (entries.expiryDate > '2019-02-19 10:44:40'))) AND (elements.dateDeleted IS NULL) AND (elements_sites.enabled=TRUE)
ORDER BY structureelements.lft, entries.postDate DESC) subquery
INNER JOIN craft_entries entries ON entries.id = subquery.elementsId
INNER JOIN craft_elements elements ON elements.id = subquery.elementsId
INNER JOIN craft_elements_sites elements_sites ON elements_sites.id = subquery.elementsSitesId
INNER JOIN craft_content content ON content.id = subquery.contentId
LEFT JOIN craft_structureelements structureelements ON structureelements.elementId = subquery.elementsId
ORDER BY structureelements.lft, entries.postDate DESC in /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Schema.php:664
Stack trace:
#0 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php(1263): yii\db\Schema->convertException(Object(PDOException), 'SELECT craft_e...') #1 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php(1148): yii\db\Command->internalExecute('SELECT craft_e...')
#2 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php(399): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Query.php(237): yii\db\Command->queryAll()
#4 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/db/Query.php(161): yii\db\Query->all(NULL)
#5 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1200): craft\db\Query->all(NULL)
#6 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/la-haute-societe/craft-elasticsearch/src/services/Elasticsearch.php(489): craft\elements\db\ElementQuery->all()
#7 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/la-haute-societe/craft-elasticsearch/src/Elasticsearch.php(336): lhs\elasticsearch\services\Elasticsearch->getEnabledEntries()
#8 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/la-haute-societe/craft-elasticsearch/src/Elasticsearch.php(111): lhs\elasticsearch\Elasticsearch->onPluginSettingsSaved()
#9 [internal function]: lhs\elasticsearch\Elasticsearch->lhs\elasticsearch{closure}(Object(craft\events\PluginEvent))
#10 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Event.php(310): call_user_func(Object(Closure), Object(craft\events\PluginEvent))
#11 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\services\...', 'afterSavePlugin...', Object(craft\events\PluginEvent))
#12 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/services/Plugins.php(702): yii\base\Component->trigger('afterSavePlugin...', Object(craft\events\PluginEvent))
#13 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/controllers/PluginsController.php(171): craft\services\Plugins->savePluginSettings(Object(lhs\elasticsearch\Elasticsearch), Array)
#14 [internal function]: craft\controllers\PluginsController->actionSavePluginSettings()
#15 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#16 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#17 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('save-plugin-set...', Array)
#18 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-plugin-set...', Array)
#19 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('plugins/save-pl...', Array)
#20 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Application.php(561): craft\web\Application->runAction('plugins/save-pl...', Array)
#21 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#22 /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#23 /Users/raygerstner/GitRespositories/mweb_web_craftcms/web/index.php(21): yii\base\Application->run()
#24 {main}
Additional Information:
Array
(
[0] => 42S22
[1] => 1054
[2] => Unknown column 'craft_elements.id' in 'field list'
)

Copied!Copy Stacktrace Search Stackoverflow Search Google Exception
Database Exception – yii\db\Exception
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'craft_elements.id' in 'field list'
The SQL being executed was: SELECT craft_elements.id AS entryId, craft_elements_sites.siteId
FROM (SELECT elements.id AS elementsId, elements_sites.id AS elementsSitesId, content.id AS contentId
FROM craft_elements elements
INNER JOIN craft_entries entries ON entries.id = elements.id
INNER JOIN craft_elements_sites elements_sites ON elements_sites.elementId = elements.id
INNER JOIN craft_content content ON content.elementId = elements.id
LEFT JOIN craft_structureelements structureelements ON structureelements.elementId = elements.id
WHERE (elements_sites.siteId=1) AND (content.siteId=1) AND (elements.archived=FALSE) AND (((elements.enabled=TRUE) AND (elements_sites.enabled=TRUE)) AND (entries.postDate <= '2019-02-19 10:44:40') AND ((entries.expiryDate IS NULL) OR (entries.expiryDate > '2019-02-19 10:44:40'))) AND (elements.dateDeleted IS NULL) AND (elements_sites.enabled=TRUE)
ORDER BY structureelements.lft, entries.postDate DESC) subquery
INNER JOIN craft_entries entries ON entries.id = subquery.elementsId
INNER JOIN craft_elements elements ON elements.id = subquery.elementsId
INNER JOIN craft_elements_sites elements_sites ON elements_sites.id = subquery.elementsSitesId
INNER JOIN craft_content content ON content.id = subquery.contentId
LEFT JOIN craft_structureelements structureelements ON structureelements.elementId = subquery.elementsId
ORDER BY structureelements.lft, entries.postDate DESC
Error Info: Array
(
[0] => 42S22
[1] => 1054
[2] => Unknown column 'craft_elements.id' in 'field list'
)

Caused by: PDOException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'craft_elements.id' in 'field list'
in /Users/raygerstner/GitRespositories/mweb_web_craftcms/vendor/yiisoft/yii2/db/Command.php at line 1258

@juban juban added the bug Something isn't working label Feb 19, 2019
@juban juban self-assigned this Feb 19, 2019
@juban
Copy link
Contributor

juban commented Feb 19, 2019

Hi @raygers,

That's weird.
Sounds like you have a defined table prefix 'craft_' in your configuration but, for some reason, the native elements table (craft_ elements in your case) can not be found.
Could you check, using some MySQL client that the table exists?
I can't see a reason why it wouldn't be the case though and what could be the relation with the saving of the plugin settings.
Do you have any other plugin or module that could influence that strange behavior?

Thanks.

@raygers
Copy link
Author

raygers commented Feb 19, 2019

Hi @juban

Thanks for the response.
Yes I do have a table called craft_elements. It definitely does exist.

The only plugins which I have installed are the following:
Amazon S3
Amazon SES
CKEditor
Elasticsearch
Element API
Feed Me
GatherContent
Redactor

I am not sure why it does not work.

I am also experiencing some issues with the plugin where the article fails to index after save. Is there anywhere where I can check logs for these failures?

image

@juban
Copy link
Contributor

juban commented Feb 19, 2019

Hi @raygers

Very strange indeed.
You could check the application log file in storage/logs/web.log to have some informations about what could go wrong.
The missing table issue is a mystery for me right now. I will try to do more tests using table prefixes to figure out what's going on. In the meantime, if have any relevant information from the log file, please, let me know.

Thanks.

@juban
Copy link
Contributor

juban commented Feb 26, 2019

Hi @raygers

Did you figure out what was going wrong?
Feel free to send me your log files so I can investigate.

Thanks.

@juban
Copy link
Contributor

juban commented Mar 5, 2019

Hi @raygers,

I'm closing the ticket as I did not get new feedback from you and can't reproduce the issue.
Please, give a try to the latest version 1.1.0-beta.2 and feel free to reopen the ticket if you have any new information to provide.

Thanks again.

@juban juban closed this as completed Mar 5, 2019
@juban juban added this to the 1.1.0 milestone Mar 6, 2019
@juban
Copy link
Contributor

juban commented Mar 6, 2019

I finally managed to reproduce the issue.
Looking for the cause of that.

@juban juban reopened this Mar 6, 2019
@raygers
Copy link
Author

raygers commented Mar 6, 2019

@juban , apologies for not getting back to you. I haven't had much time to sit and figure it out. In the interim I created an api endpoint using the ElementsApi and I feed that into ES.

If you figure it out then let me know and I will test again.

Thanks
Ray

@juban
Copy link
Contributor

juban commented Mar 6, 2019

Hi @raygers ,

No apologies needed :)
We released 1.1.0-beta.3 version which should fix the issue.
You can try it out right now and let us know. In order to test that beta, you will have to add the following parameters to your composer file, then do a composer update:

...
"minimum-stability": "dev",
"prefer-stable": true,
...

Let us know.

Thanks.

@juban
Copy link
Contributor

juban commented Mar 25, 2019

1.1.0 includes the fix.

@juban juban closed this as completed Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants