Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create a new sqlite3 database in selfoss 2.19 on FreeBSD. #1488

Closed
prbernard opened this issue Jul 5, 2024 · 1 comment · Fixed by #1489
Closed

Can't create a new sqlite3 database in selfoss 2.19 on FreeBSD. #1488

prbernard opened this issue Jul 5, 2024 · 1 comment · Fixed by #1489
Labels
Milestone

Comments

@prbernard
Copy link

Fresh install of selfoss 2.19 on FreeBSD 14.1-RELEASE-p2
nginx version 1.24.0_16,3
sqlite3 version 3.45.1,1
php version 8.3.6

When an attempt is made to create a new sqlite database the following error is listed in ../logs/default.log:

[2024-07-05 20:56:22] selfoss.ERROR: SQLSTATE[HY000]: General error: 1 no such column: table {"exception":"[object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1 no such column: table at /usr/local/www/nginx/selfoss/src/helpers/DatabaseConnection.php:144)
[stacktrace]
#0 /usr/local/www/nginx/selfoss/src/helpers/DatabaseConnection.php(144): PDO->prepare()
#1 /usr/local/www/nginx/selfoss/src/helpers/DatabaseConnection.php(193): helpers\\DatabaseConnection->execute()
#2 /usr/local/www/nginx/selfoss/src/daos/CommonSqlDatabase.php(27): helpers\\DatabaseConnection->exec()
#3 /usr/local/www/nginx/selfoss/src/daos/sqlite/Database.php(38): daos\\sqlite\\Database->exec()
#4 [internal function]: daos\\sqlite\\Database->__construct()
...

Changing line 38 in /selfoss/src/daos/sqlite/Database.php from

$result = @$this->exec('SELECT name FROM sqlite_master WHERE type = "table"');

to

$result = @$this->exec("SELECT name FROM sqlite_master WHERE type = 'table'");

solves the problem and allows the database to be created.

@jtojnar
Copy link
Member

jtojnar commented Jul 6, 2024

Thanks for reporting, should be fixed now.

I went through the code base and did not see any other instances other than in some dead code, which I removed.

@jtojnar jtojnar closed this as completed Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants