Originally posted by **justbane** August 25, 2021
Hello,
We recently updated a client site v6.9.6 of Pimcore. All went fime except for a strange DB error we get when anyone uses some customviews we have in a Perspective.
Here is the error that happens on login when loading the perspective.
```
An exception occurred while executing
'SELECT COUNT(*) FROM (SELECT COUNT(*) FROM objects WHERE (objects.o_parentId = '1'
AND ( (SELECT list FROM users_workspaces_object WHERE userId IN (20,21) AND LOCATE(CONCAT(objects.o_path,objects.o_key),cpath)=1 ORDER BY LENGTH(cpath) DESC,
FIELD(userId, 21) DESC, list DESC LIMIT 1)=1 OR (SELECT list FROM users_workspaces_object
WHERE userId IN (20,21) AND LOCATE(cpath,CONCAT(objects.o_path,objects.o_key))=1
ORDER BY LENGTH(cpath) DESC, FIELD(userId, 21) DESC, list DESC LIMIT 1)=1 )
AND objects.o_type IN ('object','folder')) AND (o_key = 'Select Lists' || o_path LIKE '/Select Lists/%') HAVING o_type = "folder" || o_type = "object") as XYZ':
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'o_type' in 'having clause'
```
Here is one of (the one noted above in the sql statement) custom views:
```
[
'treetype' => 'object', // element type is "object"
'name' => 'Select Lists', // display name
'condition' => null, // SQL condition
'icon' => '/bundles/pimcoreadmin/img/flat-color-icons/list.svg', // tree icon
'id' => 8, // unique (!!!) custom view ID
'rootfolder' => '/', // root node
'showroot' => false, // show root node or just children?
'classes' => '', // allowed classes to add; use class ids; comma-separated
'position' => 'left', // left or right accordion
'sort' => '1', // sort priority. lower values are shown first (prio for standard trees is -3 docs,-2 assets,-1 objects)
'expanded' => true, // tree is expanded by default (there can be only one expanded tree on each side)
'having' => "o_type = \"folder\" || o_type = \"object\"", // SQL having clause
'joins' => [],
'where' => "o_key = 'Select Lists' || o_path LIKE '/Select Lists/%'",
'treeContextMenu' => [
'object' => [
'items' => [
'add' => 1, // hide "Add Object" , "Add Variant"
'addFolder' => 1, // hide "Add Folder"
'importCsv' => 1, // hide "Import From CSV"
'paste' => 1, // hide "Paste"
'copy' => 1, // hide "Copy"
'cut' => 1, // hide "Cut"
'publish' => 1, // hide "Publish"
'unpublish' => 1, // hide "Unpublish"
'delete' => 1, // show "Delete" (redundant as this is the default)
'rename' => 1, // hide "Rename"
'searchAndMove' => 0, // hide "Search And Move"
'lock' => 0, // hide "Lock"
'unlock' => 0, // hide "Unlock"
'lockAndPropagate' => 0, // hide "Lock and Propagate"
'unlockAndPropagete' => 0, // hide "Unlock and Propagate"
'reload' => 1 // hide reload
]
]
]
]
```
As always appreciate any info or ides!!
Thanks!
Discussed in https://github.com/pimcore/pimcore/discussions/10136