Project

General

Profile

Actions

Bug #38406

closed

Extension Import not working with postgresql and DBAL

Added by Gerald Buttinger almost 12 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extension Manager
Target version:
-
Start date:
2012-06-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

the import of extensions is not working completely with DBAL on postgresql.

the problem lies in the function "insertLastVersion" in the file:
"/typo3/sysext/em/classes/database/class.tx_em_database.php"

on line 220, the following code:

$groupedRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'extkey, version, max(intversion) maxintversion',
'cache_extensions',
'repository=' . intval($repositoryUid),
'extkey'
);

... results in the following SQL-statement:

SELECT "extkey", "version", max("intversion") "maxintversion" FROM "cache_extensions" WHERE "repository" = 1 GROUP BY "extkey"

this is not valid in postgres due to:
1. "as" missing between max("intversion") and "maxintversion"
2. "version" missing from the group-clause

thus, the code must be changed to the following:

$groupedRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'extkey, version, max(intversion) as maxintversion',
'cache_extensions',
'repository=' . intval($repositoryUid),
'extkey, version'
);

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #39056: Tagging of latest extension not possible due to Closed2012-07-18

Actions
Actions #1

Updated by Jan Schreier almost 12 years ago

I think the current (and the suggested code) should not have version in this statement at all. Otherwise the result set will include each row of the table. this is probably the reason why I and others got timeout problems with EM often. Also the goal is to identify the highest version and assign this row lastversion=1 a few lines down the code.

so the code should be:

$groupedRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                        'extkey, max(intversion) as maxintversion',
                        'cache_extensions',
                        'repository=' . intval($repositoryUid),
                        'extkey'
                );
Actions #2

Updated by Gerrit Code Review almost 12 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12898

Actions #3

Updated by Ernesto Baschny almost 12 years ago

  • % Done changed from 0 to 50
  • TYPO3 Version changed from 4.7 to 4.5

The timeout of Jan doesn't seem to be related to this particular query (see #39056).

Anyway, the query proposed by Jan sounds reasonable. The "version" in the field list is not really required as it is not even used (although it won't break the GROUP BY) and fixing the "AS" for DBAL compatibility seems easy enough.

But since I won't be able to test or verify the fix, I'm glad if someone else can. The review request http://review.typo3.org/12898 provides the proper change (for master = 6.0, but will be backported up to 4.5, since the code hasn't changed in between).

Actions #4

Updated by Ernesto Baschny over 11 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 50 to 100
Actions #5

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF