Source databases with fields/columns named using spaces or reserved words
Last updated on
30 April 2025
Drupal's database abstraction layer cannot directly access columns named using spaces or reserved words: #1426084: Provide backtick escaping for MySQL in DB abstraction layer.
You can fix your source database column names or use the following workaround to specify the column name specifically. In this example, fulltext is a SQL reserved word.
$query = Database::getConnection('default', 'joomla_migrate')
->select('jos_content', 'jc')
->fields('jc', array('id', 'title', 'introtext', 'created', 'modified'));
$query->addExpression('`fulltext`', 'full');
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion