View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
19018Bug reports_ Unknownpublic2023-09-18 09:10
Reportertibor.pacalat Assigned Totibor.pacalat  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version5.6.x 
Summary19018: Postgres: trying to update from 5.6.31 to master caused an error
Description

I tried to upgrade from 5.x to master with postgres database and received following error:

An non-recoverable error happened during the update. Error details:
CDbCommand failed to execute the SQL statement: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
File DatabaseUpdateBase.php, line 64.

I then updated from 5.x to 6.0.0 successfully, and after trying from 6.0.0 to master same error happened

Using debug=2 I saw that the issue was with command UPDATE "lime_settings_global" SET "stg_value"=:stg_value WHERE stg_name='DBVersion'
I could run this command directly on the database without issues and then update to newest version.

Steps To Reproduce

Steps to reproduce

Look in the description.

Expected result

Shouldn't throw an error.

Actual result

An error occurred.

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)5.6.31
I will donate to the project if issue is resolvedNo
Browser
Database type & versionPostgres 15.3
Server OS (if known)
Webserver software & version (if known)
PHP Version.

Users monitoring this issue

There are no users monitoring this issue.

Activities

gabrieljenik

gabrieljenik

2023-08-11 21:47

manager   ~76545

Is this something that can be reproduced?

tibor.pacalat

tibor.pacalat

2023-08-14 14:09

administrator   ~76563

@gabrieljenik I can reproduce this. Using our local dev env I have upgraded from 3.x-LTS branch to 5.x branch and then to master.
The last step produced this (see screenshots).

tibor.pacalat

tibor.pacalat

2023-08-14 14:11

administrator   ~76566

gabrieljenik

gabrieljenik

2023-08-14 14:12

manager   ~76567

Can you run it with dbug =2 as to see the full failing sQL?

tibor.pacalat

tibor.pacalat

2023-08-14 14:28

administrator   ~76570

As already mentioned in the description of the ticket:
Using debug=2 I saw that the issue was with command UPDATE "lime_settings_global" SET "stg_value"=:stg_value WHERE stg_name='DBVersion'

tibor.pacalat

tibor.pacalat

2023-08-14 14:29

administrator   ~76571

gabrieljenik

gabrieljenik

2023-08-14 15:04

manager   ~76575

As already mentioned in the description of the ticket:

Yes, but now we can see the full stack and the value of the stg_value parameter

gabrieljenik

gabrieljenik

2023-08-14 17:11

manager   ~76579

Can you please include the full contents of the screen?
The whole dump. You can try printing as pdf.

gabrieljenik

gabrieljenik

2023-08-14 17:21

manager   ~76580

From here: https://stackoverflow.com/a/13103690/1392917

The reason you get this error is because you have entered a transaction and one of your SQL Queries failed, and you gobbled up that failure and ignored it. But that wasn't enough, THEN you used that same connection, using the SAME TRANSACTION to run another query. The exception gets thrown on the second, correctly formed query because you are using a broken transaction to do additional work. PostgreSQL by default stops you from doing this.

I would say to try this.
Before running the last upgarde, please update the file application/helpers/update/updates/Update_605.php
Remove the try catch structures.
If that works, it means we need to find another way to check if the index exists.

Ex:

if(($this->db->getTable('{{xxxxx}}')->hasIndex('uniqueindex')){
....
}
tibor.pacalat

tibor.pacalat

2023-08-15 13:32

administrator   ~76596

Last edited: 2023-08-15 13:33

I removed the try/catch from update, still getting an error, just different.
The issue now is:
CDbCommand failed to execute the SQL statement: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "lime_idx1_quota_id" already exists. The SQL statement executed was: CREATE INDEX "lime_idx1_quota_id" ON "lime_quota_languagesettings" ("quotals_quota_id")

error_postgres.pdf (200,697 bytes)
gabrieljenik

gabrieljenik

2023-08-15 13:43

manager   ~76599

OK, great. it worked as expected.

it means we need to find another way to check if the index exists.

gabrieljenik

gabrieljenik

2023-08-18 14:33

manager   ~76641

Master: https://github.com/LimeSurvey/LimeSurvey/pull/3370

gabrieljenik

gabrieljenik

2023-08-18 14:33

manager   ~76642

@tibor.pacalat this should be testes with mysql (and mssql) as well

DenisChenu

DenisChenu

2023-08-30 14:49

developer   ~76786

@tibor.pacalat this should be tested added manually the index before update …

tibor.pacalat

tibor.pacalat

2023-09-14 18:05

administrator   ~77057

Tested and merged.

guest

guest

2023-09-14 18:13

viewer   ~77060

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=35484

guest

guest

2023-09-14 18:13

viewer   ~77061

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=35483

LimeBot

LimeBot

2023-09-18 09:10

administrator   ~77097

Fixed in Release 6.2.7+230918

Related Changesets

LimeSurvey: master 5c4fb4e0

2023-09-14 20:04

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 19018: Postgres - trying to update from 5.6.31 to master caused an error (#3370)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
19018
mod - application/helpers/update/updates/Update_605.php Diff File

LimeSurvey: master 5c4fb4e0

2023-09-14 20:04

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 19018: Postgres - trying to update from 5.6.31 to master caused an error (#3370)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
19018
mod - application/helpers/update/updates/Update_605.php Diff File

Issue History

Date Modified Username Field Change
2023-08-09 13:46 tibor.pacalat New Issue
2023-08-11 21:47 gabrieljenik Note Added: 76545
2023-08-11 21:47 gabrieljenik Bug heat 0 => 2
2023-08-14 14:09 tibor.pacalat Note Added: 76563
2023-08-14 14:09 tibor.pacalat File Added: Screenshot 2023-08-14 at 14.08.01.png
2023-08-14 14:09 tibor.pacalat File Added: Screenshot 2023-08-14 at 14.08.11.png
2023-08-14 14:09 tibor.pacalat Bug heat 2 => 4
2023-08-14 14:10 tibor.pacalat File Deleted: Screenshot 2023-08-14 at 14.08.11.png
2023-08-14 14:11 tibor.pacalat File Deleted: Screenshot 2023-08-14 at 14.08.11.png
2023-08-14 14:11 tibor.pacalat Note Added: 76566
2023-08-14 14:11 tibor.pacalat File Added: Screenshot 2023-08-14 at 14.10.43.png
2023-08-14 14:12 gabrieljenik Note Added: 76567
2023-08-14 14:28 tibor.pacalat Note Added: 76570
2023-08-14 14:29 tibor.pacalat Note Added: 76571
2023-08-14 14:29 tibor.pacalat File Added: Screenshot 2023-08-14 at 14.29.23.png
2023-08-14 15:04 gabrieljenik Note Added: 76575
2023-08-14 17:11 gabrieljenik Note Added: 76579
2023-08-14 17:21 gabrieljenik Note Added: 76580
2023-08-14 17:21 gabrieljenik Status new => confirmed
2023-08-15 13:32 tibor.pacalat Note Added: 76596
2023-08-15 13:32 tibor.pacalat File Added: error_postgres.pdf
2023-08-15 13:32 tibor.pacalat File Added: Screenshot 2023-08-15 at 13.24.09.png
2023-08-15 13:32 tibor.pacalat File Added: error_postgres_after_change.pdf
2023-08-15 13:33 tibor.pacalat Note Edited: 76596
2023-08-15 13:43 gabrieljenik Note Added: 76599
2023-08-15 13:44 gabrieljenik Assigned To => gabrieljenik
2023-08-15 13:44 gabrieljenik Status confirmed => assigned
2023-08-18 14:33 gabrieljenik Assigned To gabrieljenik => DenisChenu
2023-08-18 14:33 gabrieljenik Status assigned => ready for code review
2023-08-18 14:33 gabrieljenik Note Added: 76641
2023-08-18 14:33 gabrieljenik Note Added: 76642
2023-08-30 14:49 DenisChenu Note Added: 76786
2023-08-30 14:49 DenisChenu Bug heat 4 => 6
2023-08-30 14:50 DenisChenu Assigned To DenisChenu =>
2023-08-30 14:50 DenisChenu Status ready for code review => ready for testing
2023-08-30 15:39 gabrieljenik Assigned To => tibor.pacalat
2023-09-14 18:05 tibor.pacalat Status ready for testing => resolved
2023-09-14 18:05 tibor.pacalat Resolution open => fixed
2023-09-14 18:05 tibor.pacalat Note Added: 77057
2023-09-14 18:13 Changeset attached => LimeSurvey master 5c4fb4e0
2023-09-14 18:13 Changeset attached => LimeSurvey master 5c4fb4e0
2023-09-14 18:13 guest Note Added: 77060
2023-09-14 18:13 guest Note Added: 77061
2023-09-14 18:13 guest Bug heat 6 => 8
2023-09-14 18:13 guest Bug heat 6 => 8
2023-09-18 09:10 LimeBot Note Added: 77097
2023-09-18 09:10 LimeBot Status resolved => closed
2023-09-18 09:10 LimeBot Bug heat 8 => 10