Error converting psql to mariadb: QuoteHelper.php line 62: Only strings, Literals and Parameters are allowed

Nextcloud version (eg, 20.0.5): 21.0
Operating system and version (eg, Ubuntu 20.04): MacOS Big Sur
Apache or nginx version (eg, Apache 2.4.25): 2.4.46
PHP version (eg, 7.4): 7.4.15

The issue you are facing:
When I convert DB (in this case: from Postgresql to MariaDB) I get error message In QuoteHelper.php line 62: Only strings, Literals and Parameters are allowed

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

php occ db:convert-type --clear-schema mysql <myuser> 127.0.0.1 <mydb>

What is the database password?
Clearing schema in new database
Creating schema in new database
The following tables will not be converted:
oc_audioplayer_genre
...
oc_retention
oc_users_external
Please note that tables belonging to available but currently not installed apps
can be included by specifying the --all-apps option.
Continue with the conversion (y/n)? [n] y
oc_accounts
 0/2 [>---------------------------]   0%
In QuoteHelper.php line 62:

  Only strings, Literals and Parameters are allowed

Stack trace shows that instance of Doctrine\DBAL\Schema\Column is passed to quoteColumnName($string).

As quick workaround I added to QuoteHelper.php (line 57):

if ($string instanceof \Doctrine\DBAL\Schema\Column) {
    return $string->getName();
}
1 Like

This should be reported to the Github Server section here:

1 Like

Can be found here:

Where should the QuoteHelper.php be located? I used find but i can’t locate this file to do the workaround.

lib/private/DB/QueryBuilder/QuoteHelper.php

1 Like

Thank you very much

There’s another string at line 57 with my QuoteHelper.php. Is the workaround supposed to replace this one or go above/below?

57                 if ($string === null || $string === 'null' || $string === '*') {
58                         return $string;

I am running into this error while converting from MariaDB to Postgres.

@tomz - I was running into this issue and i took OP’s direction by adding it at line 57 and bumping everything else down.

My migration went fine afterwards - had to clear out the tables that was originally created in the psql db first though. Otherwise, it just error’d out during the migration.

1 Like

Just finished my first migration. Took a bit longer than expected given the small amount of data but things worked flawlessly once the workaround was applied. I am impressed!

Seems like the mentioned bug was fixed just recently in Don't pass a column object to addOrderBy by kesselb · Pull Request #27429 · nextcloud/server · GitHub

1 Like