We recently had an issue where a page had no parent page and it was not showing on the sidebar, although the page was directly accessible. I fixed the issue by "moving" the page and listing the correct parent during the move.
I would like to query the database (Postgres) to see how many other pages do not have a parent page listed, in order to see if we have other pages with the same issue.
I need help with that query.
Thank you