Error when creating page types

Permalink
An exception occurred while executing 'select cID from Pages where cParentID in () and cInheritPermissionsFromCID = ': SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') and cInheritPermissionsFromCID =' at line 1

 
jero replied on at Permalink Reply
jero
I have just had the same problem on a site updated to 8.2.1. After a bit of digging, I found that the cause appears to be a deleted or missing page that is still referenced in the PageTypePageTemplateDefaultPages table. Whether the upgrade is the issue here I don't know.

For example, attempting to edit a page default e.g.

dashboard/pages/types/output/edit_defaults/11/6

results in the error.

Looking in PageTypePageTemplateDefaultPages I find

pTemplateID, ptID, cID
6,11, 185

But trying to open index.php?cID=185 results in a not found error, rather than a permission denied error which is returned for other pages referenced in this table.

removing this record from PageTypePageTemplateDefaultPages fixes the problem, since a new record and page are created to take its place for that combination of template and page type.