Cockpit icon indicating copy to clipboard operation
Cockpit copied to clipboard

Login: SQLSTATE[HY000]: General error: 1 no such column: criteria667bbee641d33

Open adiba opened this issue 1 year ago • 2 comments

When trying to log in (with $debug=true), I receive an error toast:

SQLSTATE[HY000]: General error: 1 no such column: criteria667bbee641d33

the HEX string after 'criteria' changes, but always starts with 667.

My cockpit v2.3.0 installation worked fine on the same system for a year until this week. I didn't even change anything in code, data, or configuration.
I also tried to re-install - same problem.

Any ideas how I can debug this further and track down the problem?

adiba avatar Jun 26 '24 07:06 adiba

Hey 👋

Hard to tell what is wrong here. Did anything changed with your infra setup (php version etc?)

aheinze avatar Jun 28 '24 21:06 aheinze

Hey 👋

Hard to tell what is wrong here. Did anything changed with your infra setup (php version etc?)

Thank you for your reply :)

I did not change anything and apparently my hosting provider did not change anything either.
The PHP version has been 8.1 since day 1.

adiba avatar Jun 29 '24 07:06 adiba

Hello, i have the same error. I am using sqlite 3.46.0. I noticed that when I edit the code, the connections look correct: lib/MongoLite/Cursor.php

$sql[] = 'WHERE document_criteria("'.$this->criteria.'", document)'; Change to:

$sql[] = 'WHERE document_criteria(\''.$this->criteria.'\', document)';

Is it a matter of sqlite itself or Cockpit? The error started appearing recently. I am unable to install the new version of Cockpit.

Orygaw avatar Jul 24 '24 17:07 Orygaw

Cockpit requires PHP 8.2. Can you confirm that you use PHP >= 8.2?

aheinze avatar Jul 24 '24 18:07 aheinze

This is not a PHP issue. The SQLite developers have been announcing the change for years, but the Cockpit developers missed it. It is explained here: https://sqlite.org/quirks.html#double_quoted_string_literals_are_accepted.

Munrok avatar Jul 25 '24 12:07 Munrok

Thank you for the hint 👍 Fix will be available in the next release!

aheinze avatar Jul 30 '24 00:07 aheinze

Hi @aheinze, it seems that the fix should be applied here as well:

COCKPIT[ERROR]: SQLSTATE[HY000]: General error: 1 no such column: "criteria66d71829062f3" - should this be a string literal in single-quotes? @/lib/MongoLite/Collection.php:146

$sql = 'SELECT id, document FROM'.$this->name.' WHERE document_criteria("'.$this->database->registerCriteriaFunction($criteria).'", document)';

I hope no other places left.

pshemek avatar Sep 03 '24 14:09 pshemek

Hi @aheinze, it seems that the fix should be applied here as well:

COCKPIT[ERROR]: SQLSTATE[HY000]: General error: 1 no such column: "criteria66d71829062f3" - should this be a string literal in single-quotes? @/lib/MongoLite/Collection.php:146

$sql = 'SELECT id, document FROM'.$this->name.' WHERE document_criteria("'.$this->database->registerCriteriaFunction($criteria).'", document)';

I hope no other places left.

Thank you for reporting!

aheinze avatar Sep 04 '24 15:09 aheinze

In @/lib/MongoLite/Cursor.php

$sql[] = 'WHERE document_criteria("'.$this->criteria.'", document)';

into

$sql[] = "WHERE document_criteria('{$this->criteria}', document)";

as well.

pshemek avatar Sep 16 '24 08:09 pshemek

@pshemek this should already be fixed in the current dev codebase

aheinze avatar Sep 16 '24 12:09 aheinze