Forum

Thread tagged as: Problem

Perch content custom and Invalid query: SQLSTATE[42000]

Hi,

Im trying to list content from subpages with perch content custom. This is my code:

<?php perch_content_custom('Intro', array(
                'page'=>'/kundereferanser-oversikt.php/*',
                'template'=>'kundereferanse-liste.html',
                ));
            ?>

It wont list any content from those subpages. I have enabled debug message and get this error: Invalid query: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tbl.regionID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Erick Green

Erick Green 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the query you get before that error? I think this is something we already have fixed in dev, but it would be good to confirm.

Debug Message

[16] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched page: /kundereferanser-oversikt, so not using routes.
Using master page: /templates/pages/kundereferanser-oversikt.php
[2] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/kundereferanser-oversikt' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT * FROM perch2_pages WHERE pagePath='/kundereferanser-oversikt' LIMIT 1
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
[6] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/kundereferanser-oversikt' LIMIT 1
[1] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004', '000') ORDER BY pageTreePosition DESC
[6] Using template: /templates/navigation/navigasjon.html
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/kundereferanser-oversikt' OR pageSortPath='/kundereferanser-oversikt' LIMIT 1
[1] SELECT * FROM perch2_pages WHERE pageHidden=0 AND pageNew=0 AND pageTreePosition IN ('000-004', '000') ORDER BY pageTreePosition
[1] Using template: /templates/navigation/breadcrumbs.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Overskrift' AND (regionPage='/kundereferanser-oversikt' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=15 AND idx.itemRev=2)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
[1] Using template: /templates/content/h1.html
[6] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Innhold' AND (regionPage LIKE '/%' OR regionPage='*')
SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=48 AND idx.itemRev=12) OR (idx.regionID=41 AND idx.itemRev=4) OR (idx.regionID=17 AND idx.itemRev=22) OR (idx.regionID=23 AND idx.itemRev=1) OR (idx.regionID=44 AND idx.itemRev=5) OR (idx.regionID=46 AND idx.itemRev=4)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
Invalid query: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tbl.regionID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Using template: /templates/content/ut/kundereferanse-ut-liste.html
Request time: 0.0318
Process time: 0.0316
Memory: 2.6332
Drew McLellan

Drew McLellan 2638 points
Perch Support

Thanks!

Did you figure out the error? We are trying to list content from several under-pages.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, we figured it out.

And? How do we fix this so we can list content from the pages?

Drew McLellan

Drew McLellan 2638 points
Perch Support

The fix will be in v3.0.1

And when will this version release? We need this function to work this week. Its an essential function in our project.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's most likely to be today.

Is the Runway v3.0.1 update coming soon?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, it should be today.

Drew McLellan

Drew McLellan 2638 points
Perch Support

This is now available.

Thanks!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Let us know if that's fixed it for you.

It fixed the listing problem, thanks! Looking good as well the new Runway version!