-- lang_with.html: a WITH clause's names are visible throughout the statement, -- not just in the query block that carries it, so a subquery of the select list -- reads them like any other relation. Neither count here reaches `co` through a -- FROM clause of its own block. WITH co AS (SELECT package_name, package_ver FROM layers WHERE package_name = 'cohttp') SELECT (SELECT count(*) FROM co), (SELECT count(DISTINCT package_ver) FROM co);