Skip to content

extension breaks PostgreSQL installation

Hello.

Extension does not work on PostgeSQL installation (TYPO3 9.5.13, gridelements 9.4.1):

Database Error SQLSTATE[42703]: Undefined column: 7 ERROR: column tt_content.ctype does not exist LINE 1: ....sys_language_uid = -1) AND tt_content.pid=57 AND tt_content... ^ HINT: Perhaps you meant to reference the column "tt_content.CType".. A SQL error occurred. This may indicate a schema mismatch between TCA and the database. Try running database compare in the Install Tool.

Problem is in file Configuration/TCA/Overrides/tt_content.php line 88:

'foreign_table_where' => "AND (tt_content.sys_language_uid = ###REC_FIELD_sys_language_uid### OR tt_content.sys_language_uid = -1) AND tt_content.pid=###CURRENT_PID### AND tt_content.CType='gridelements_pi1' AND (tt_content.uid != ###THIS_UID###) AND (tt_content.tx_gridelements_container != ###THIS_UID### OR tt_content.tx_gridelements_container=0) ORDER BY tt_content.header, tt_content.uid",

PgSQL is case sensetive. But, surprise!, it converts all unquoted identifiers to lowercase before execution.

So, this code:

AND tt_content.CType='gridelements_pi1'

would be executed as

AND tt_content.ctype='gridelements_pi1'

and will fail because field name is actually СType as it is created during TYPO3 setup.

You have to fix this by explicitly quoting field name:

AND tt_content.\"CType\"='gridelements_pi1'

I've checked this code works OK on PgSQL. But I'm not sure would it be OK on other databases or not.

Edited by Boris Gulay