View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
18571Bug reportsInstallationpublic2022-12-29 19:28
Reporterlintu Assigned Togabrieljenik  
PrioritynoneSeveritycrash 
Status closedResolutionunable to reproduce 
Product Version5.4.x 
Summary18571: Database upgrade failing with an error message
Description

Hello,

I was attempting to upgrade the database and got the following error:

An non-recoverable error happened during the update. Error details:
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'question' in 'field list'

File DatabaseUpdateBase.php, line 47.
Please fix this error in your database and try again

Additional info:
LimeSurvey Community Edition version 5.4.15
Current database version: 364
Target database version: 495

I saw a similar bug report that was closed. Was there a fix for it?

Thanks

Steps To Reproduce

Steps to reproduce

(Replace this text with detailed step-by-step instructions on how to reproduce the issue)

Expected result

(Write here what you expected to happen)

Actual result

(Write here what happened instead)

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)5.4.15
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL Engine version 8.0.31
Server OS (if known)Amazon Linux 2/3.5.2
Webserver software & version (if known)
PHP VersionPHP 8.1

Users monitoring this issue

There are no users monitoring this issue.

Activities

lintu

lintu

2022-12-26 03:29

reporter   ~73310

Debug notes:
CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'question' in 'field list'. The SQL statement executed was: INSERT INTO lime_question_l10ns (qid, question, help, language) select qid, question, help, language from lime_questions

/var/app/current/vendor/yiisoft/yii/framework/db/CDbCommand.php(358)

346 {
347 if($this->_connection->enableProfiling)
348 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().$par.')','system.db.CDbCommand.execute');
349
350 $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
351 $message=$e->getMessage();
352 Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
353 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
354
355 if(YII_DEBUG)
356 $message.='. The SQL statement executed was: '.$this->getText().$par;
357
358 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
359 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
360 }
361 }
362
363 /*
364
Executes the SQL statement and returns query result.
365 This method is for executing an SQL query that returns result set.
366
@param array $params input parameters (name=>value) for the SQL execution. This is an alternative
367 to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
368
them in this way can improve the performance. Note that if you pass parameters in this way,
369 you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
370
Please also note that all values are treated as strings in this case, if you need them to be handled as
Stack Trace
#0
– /var/app/current/application/helpers/update/updates/Update_400.php(44): CDbCommand->execute()
39 ['qid', 'language'],
40 true
41 );
42 $this->db->createCommand(
43 "INSERT INTO {{question_l10ns}} (qid, question, help, language) select qid, question, help, language from {{questions}}"
44 )->execute();
45 / questions by rename/insert /
46 if ($this->db->schema->getTable('{{questions_update400}}')) {
47 $this->db->createCommand()->dropTable('{{questions_update400}}');
48 }
49 $this->db->createCommand()->renameTable('{{questions}}', '{{questions_update400}}');
#1
– /var/app/current/application/helpers/update/DatabaseUpdateBase.php(47): LimeSurvey\Helpers\Update\Update_400->up()
42 */
43 public function safeUp()
44 {
45 $transaction = $this->db->beginTransaction();
46 try {
47 $this->up();
48 $this->updateVersion();
49 $transaction->commit();
50 } catch (Throwable $e) {
51 $transaction->rollback();
52 throw $e;
#2
– /var/app/current/application/helpers/update/updatedb_helper.php(88): LimeSurvey\Helpers\Update\DatabaseUpdateBase->safeUp()
83 try {
84 // Get all relevant files from updates/ folder
85 $updates = getRelevantUpdates($iOldDBVersion, Yii::app()->db, $options);
86 foreach ($updates as $update) {
87 // NB: safeUp() wraps up() inside a transaction and also updates DBVersion.
88 $update->safeUp();
89 }
90 } catch (Exception $e) {
91 Yii::app()->setConfig('Updating', false);
92 // Activate schema caching
93 $oDB->schemaCachingDuration = 3600;

gabrieljenik

gabrieljenik

2022-12-29 15:01

manager   ~73312

Couldn't reproduce the issue.

First I checked out commit 7ece09b, which is the last one with DB version 364, and I generated a new DB.
Then I went to master and upgraded, and it upgraded with no problem. With debug=2. I tested it with PHP 7.4 and 8.0 .
No errors.

The error mentioned in the ticket is this:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'question' in 'field list'. The SQL statement executed was: INSERT INTO lime_question_l10ns (qid, question, help, language) select qid, question, help, language from lime_questions

I don't know under what circumstances that might happen. I don't know if the error refers to the "field list" of the INSERT or the SELECT, but in both cases it would be rare.

Can I ask for the structure of the tables lime_questions and lime_question_l10ns ?

Thanks

lintu

lintu

2022-12-29 15:05

reporter   ~73313

I have manually updated the Lime database to move on with the upgrade. So, now the structure of the tables lime_questions and lime_question_l10ns are the same.

gabrieljenik

gabrieljenik

2022-12-29 15:10

manager   ~73314

So we can close the ticket?

lintu

lintu

2022-12-29 16:56

reporter   ~73317

Yes, kindly close the ticket. Thanks

Issue History

Date Modified Username Field Change
2022-12-26 02:48 lintu New Issue
2022-12-26 03:29 lintu Note Added: 73310
2022-12-26 03:29 lintu Bug heat 0 => 2
2022-12-29 15:01 gabrieljenik Note Added: 73312
2022-12-29 15:01 gabrieljenik Bug heat 2 => 4
2022-12-29 15:01 gabrieljenik Assigned To => gabrieljenik
2022-12-29 15:01 gabrieljenik Status new => feedback
2022-12-29 15:05 lintu Note Added: 73313
2022-12-29 15:05 lintu Status feedback => assigned
2022-12-29 15:10 gabrieljenik Note Added: 73314
2022-12-29 16:56 lintu Note Added: 73317
2022-12-29 19:28 gabrieljenik Status assigned => closed
2022-12-29 19:28 gabrieljenik Resolution open => unable to reproduce