Advanced MSSQL query workaround for limit, offset and for sql with aggregate functions#13262
Advanced MSSQL query workaround for limit, offset and for sql with aggregate functions#13262wilsonge merged 4 commits intojoomla:stagingfrom
Conversation
7318025 to
4e6663c
Compare
f48b75d to
c5d2340
Compare
349f10b to
238413e
Compare
|
@waader Which URL page or sql query did not work? |
|
With current staging, testing data and your patch applied just go to the frontend. There are a lot of notices (something in the module helper). I have already shutdown my test pc, so I could give you the exact messages tomorrow. |
|
I have found a few errors and I fixed it. |
|
i'm testing on backend and seems ok, unfortunately even if is not caused by this pr i see issues on frontend too as reported by @waader |
|
With testing data installed frontend gives an "404 Component not found" error. Starting with index.php?option=com_content the page loads. The module helper notices are also present and no modul content is displayed. In backend I get an error when deleting Banner Tracks: |
|
Can you have a look at Smart Search > Content Maps: [Microsoft][SQL Server Native Client 11.0][SQL Server]Column "d.branch_title" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause. |
|
I will take a look. Are you sure do you use the last commit in this PR, I added it today morning (night)? |
|
I have several patches for mssql installed now and also this patch and now the problem with content map has gone away. Frontend is broken nonetheless. |
|
On test database I have found two 404 links because mssql table does not have 2 articles for:
but home page work for me ok. |
|
Frontend issue is a separate issue with a fix here: #14057 |
I assume this is php 5.3 issue, I have created an issue. |
|
@csthomas that redirect plugin error might be related to this pr :) |
I have found a big problem with sqlsrv updates in joomla (administrator/components/com_admin/sql/updates/sqlazure/*.sql). https://msdn.microsoft.com/en-us/library/ms190273.aspx They are not executed to database at all. At least for my environment. |
|
@csthomas: Can you sychronize this patch with the changes made in other yet commited sqlserver-patches. |
|
OK. Please wait a moment |
* Fix offset, limit - intruduce SELECT TOP * Add multi table update for mssql query * Add more advanced workaround for mssql GROUP BY. * Add required aliases to complex columns (ex. function) in subqueries. * Add workaround for use alias in GROUP BY statement * Add to GROUP BY statement columns from ORDER BY * Remove column with static string, NULL or numeric from GROUP BY statement * Add unit tests
|
Please ignore errors like: It is unrelated, and it is waiting for a new PR. |
…onents/com_admin/sql/updates/sqlazure
|
There is not need to combine this PR for tests with #14102 in the same time. But if someone want to test 2 PRs at once then:
|
|
I have tested this item ✅ successfully on 00fd4a9 Thanks! This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13262. |
|
Last commit fix error on "sample testing" for menu items:
|
|
For All tags the is other error which has to be resolved by separate PR.
|
|
Merged with waaders test given this is only affecting mssql |
|
Thanks |
|
@csthomas Will you consider making these changes to the Framework also? |
Competition for #11938
Summary of Changes
Fix various problems with sqlsrv queries:
OFFSET, which means use wrapped query to emulate offset. Every column inSELECTstatement required alias if it is placed in subquery.SELECTcontains a wild columnx.*then load and put all columns from x table toGROUP BYGROUP BYcontains alias to (column or expression) then replace it with expression.Ex:
SELECT LOWER(name) AS name, catid AS cc, count(*) ... GROUP BY name, ccwill be replaced to
SELECT LOWER(name) AS name, count(*) ... GROUP BY LOWER(name), catidORDER BYto GROUP BY if not yet exists. If this is an alias then replace it with expression as mentioned earlier.SELECTtoGROUP BYif missing (related to mysqlONLY_FULL_GROUP_BY). Probably it would be better to fix joomla queries than create such workaround.Example of fixed query:
SELECT id, name, COUNT(*) FROM #__x GROUP BY idwill be replaced by:
SELECT id, name, COUNT(*) AS columnAlias0 FROM #__x GROUP BY id, nameFixed issue: #11279
Removes notices, warnings and errors from:
Fix issue with Popular Tags module on the front end.
Testing Instructions
Be sure that you can see PHP Notices.
Test above links and module Popular Tags before and after patch.
Documentation Changes Required
No