Actions
Bug #92712
openDBAL-DriverException in suggest wizard on PostgreSQL
Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2020-10-27
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
postgresql
Complexity:
Is Regression:
Sprint Focus:
Description
For a label-definition in TCA its a perfectly valid usecase to add a column defined as an integer, be it you want to display the integer itself or displaying data of a parent record referenced in that column.
Consider this definition:
Configuration/TCA/tx_myextension_post.php
return [
'ctrl' => [
'title' => 'Post',
'label' => 'post_title',
'label_alt_force' => TRUE,
'label_alt' => 'blog',
],
'types' => ['1' => ['showitem' => 'post_title,blog']],
'columns' => [
'post_title' => [
'label' => 'Post title',
'config' => [
'type' => 'input',
]
],
'blog' => [
'label' => 'Blog this Post belongs to',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'foreign_table' => 'tx_myextension_blog',
'allowed' => 'tx_myextension_blog',
'size' => 1,
'suggestOptions' => [
'default' => [
'searchWholePhrase' => TRUE
]
]
]
],
],
];
Configuration/TCA/tx_myextension_blog.php
return [
'ctrl' => [
'title' => 'Blog',
'label' => 'blog_title',
'label_alt_force' => TRUE,
'label_alt' => 'blog_int',
],
'types' => ['1' => ['showitem' => 'blog_title,blog_number']],
'columns' => [
'blog_title' => [
'label' => 'Blog title',
'config' => [
'type' => 'input',
]
],
'blog_number' => [
'label' => 'Blog number as an example integer',
'config' => [
'type' => 'input',
'eval' => 'int',
]
],
],
];
ext_tables.sql
CREATE TABLE tx_myextension_post (
uid int(10) unsigned NOT NULL auto_increment,
pid int(10) unsigned NOT NULL DEFAULT '0',
post_title varchar(255) NOT NULL DEFAULT '',
blog int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (uid),
KEY parent (pid)
);
CREATE TABLE tx_myextension_blog (
uid int(10) unsigned NOT NULL auto_increment,
pid int(10) unsigned NOT NULL DEFAULT '0',
blog_title varchar(255) NOT NULL DEFAULT '',
blog_number int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (uid),
KEY parent (pid)
);
If you search for a Blog in the suggest wizard of a Post on PostgreSQL you receive a DBAL-DriverException:
(1/3) Doctrine\DBAL\Exception\DriverException An exception occurred while executing 'SELECT * FROM "tx_myextension_blog" WHERE (("blog_title" LIKE ?) OR ("blog_number" LIKE ?)) LIMIT 50' with params ["%Foo%", "%Foo%"]: SQLSTATE[42883]: Undefined function: 7 FEHLER: Operator existiert nicht: bigint ~~ unknown LINE 1: ...et" WHERE (("blog_title" LIKE $1) OR ("blog_number" LIKE $2)) ... ^ HINT: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen.
This happens as blog_number, being an integer and part of a label, is used in a LIKE query
Actions