View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
20021Bug reportsCentral participant databasepublic2025-03-30 22:51
Reportermo2025 Assigned Togabrieljenik  
PrioritynoneSeveritycrash 
Status assignedResolutionopen 
Product Version6.6.x 
Summary20021: Deleting a participants leads to 500: Internal server error
Description

We are using a standard limesurvey installation on Ubuntu linux, but Microsoft Azure SQL Server.
Whenever we want to delete a participants, we get an internal server error:

500: Interner Serverfehler - CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The multi-part identifier "dbo.lime_tokens_719895.tid" could not be bound.

We were able to identify the issue: There is an alias for the table, but the alias is not used in the WHERE clausel. In the end the following statement is used:

SELECT * FROM lime_tokens_719895 <ALIAS> WHERE [dbo].[lime_tokens_841351].[tid]=1

Steps To Reproduce

Steps to reproduce

  1. Select a participants to delete.

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

Expected result

Participant is deleted.

(Write here what you expected to happen)

Actual result

500 Internal error

(Write here what happened instead)

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)6.12.0+250317
I will donate to the project if issue is resolvedNo
BrowserChrome / any browser
Database type & versionMicrosoft Azure SQL Server
Server OS (if known)Ubuntu Server
Webserver software & version (if known)Apache
PHP Version8.1.32

Users monitoring this issue

mo2025

Activities

mo2025

mo2025

2025-03-19 10:55

reporter   ~82285

The SQL
SELECT * FROM [dbo].[lime_tokens_841351] [lime_tokens_841351] WHERE [dbo].[lime_tokens_841351].[tid]=1

I added in
/limesurvey/vendor/yiisoft/yii/framework/db/schema/CDbCommandBuilder.php

in function
public function createColumnCriteria($table,$columns,$condition='',$params=array(),$prefix=null)

after

if($prefix===null)
$prefix=$table->rawName.'.';

the line
$prefix = '';

to remove the "[dbo]." from the [dbo].[lime_tokens_841351].[tid]=1

so the WHERE clause fit the alias Name.

I'm sure that this "fix" is not valid for all situation and should be somewhere in the limesurvey part, but it would be good if this issue cloud be fixed for all user, who also use Microsoft SQL Server.

mo2025

mo2025

2025-03-19 10:59

reporter   ~82286

Probably in limesurvey/application/models/LSActiveRecord.php

mo2025

mo2025

2025-03-19 12:37

reporter   ~82288

Yes, it is better to change line 206 in application/models/LSActiveRecord.php to damange not other parts of the application.
I changed
$criteria = $builder->createColumnCriteria($table, $attributes, $condition, $params);
to
$criteria = $builder->createColumnCriteria($table, $attributes, $condition, $params,"");

Issue History

Date Modified Username Field Change
2025-03-19 09:26 mo2025 New Issue
2025-03-19 09:27 mo2025 Issue Monitored: mo2025
2025-03-19 09:27 mo2025 Bug heat 0 => 2
2025-03-19 10:55 mo2025 Note Added: 82285
2025-03-19 10:55 mo2025 Bug heat 2 => 4
2025-03-19 10:59 mo2025 Note Added: 82286
2025-03-19 12:37 mo2025 Note Added: 82288
2025-03-30 22:51 tibor.pacalat Assigned To => gabrieljenik
2025-03-30 22:51 tibor.pacalat Status new => assigned