CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "groups_pkey"
DETAIL: Key (gid)=(32) already exists.. The SQL statement executed was: INSERT INTO "groups" ("sid", "group_order", "randomization_group", "grelevance") VALUES (:yp0, :yp1, :yp2, :yp3). Bound with :yp0=445325, :yp1=2, :yp2='', :yp3=''

/var/www/html/sg_survey/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

#2
+
 /var/www/html/sg_survey/application/helpers/admin/import_helper.php(1510): CActiveRecord->save()
1505             }
1506             if (!isset($aGIDReplacements[$oldgid])) {
1507                 $questionGroup = new QuestionGroup();
1508                 $questionGroup->attributes = $insertdata;
1509                 $questionGroup->sid = $iNewSID;
1510                 if (!$questionGroup->save()) {
1511                     safeDie(gT("Error").": Failed to insert data [3]<br />");
1512                 }
1513                 $newgid = $questionGroup->gid;
1514                 $aGIDReplacements[$oldgid] = $newgid; // add old and new qid to the mapping array
1515                 $results['groups']++;
#3
+
 /var/www/html/sg_survey/application/helpers/admin/import_helper.php(1206): XMLImportSurvey("/var/www/html/sg_survey/tmp/6xdpwuc5yxd8g7dcw9ge2eptp76ny6.lss", "<?xml version="1.0" encoding="UTF-8"?> <document> <LimeSurveyDo...", null, null, ...)
1201     } else {
1202         $sExtension = "";
1203     }
1204     switch ($sExtension) {
1205         case 'lss':
1206             $aImportResults = XMLImportSurvey($sFullFilePath, null, $sNewSurveyName, $DestSurveyID, $bTranslateLinksFields);
1207             if (!empty($aImportResults['newsid'])) {
1208                 TemplateConfiguration::checkAndcreateSurveyConfig($aImportResults['newsid']);
1209             }
1210             return $aImportResults;
1211         case 'txt':
#4
+
 /var/www/html/sg_survey/application/controllers/admin/surveyadmin.php(1231): importSurveyFile("/var/www/html/sg_survey/tmp/6xdpwuc5yxd8g7dcw9ge2eptp76ny6.lss", true)
1226 
1227             // Now, we have the survey : start importing
1228             Yii::app()->loadHelper('admin/import');
1229 
1230             if ($action == 'importsurvey' && !$aData['bFailed']) {
1231                 $aImportResults = importSurveyFile($sFullFilepath, (Yii::app()->request->getPost('translinksfields') == '1'));
1232                 if (is_null($aImportResults)) {
1233                     $aImportResults = array(
1234                         'error'=>gT("Unknown error while reading the file, no survey created.")
1235                     );
1236                 }
2020-03-26 16:34:34 nginx/1.14.0 Yii Framework/1.1.22-dev