Does PostgreSQL have a pseudo-column like “LEVEL” in Oracle?
问题 Does PostgreSQL have a pseudo-column like "LEVEL" in Oracle? If not, then how can we create a column similar to "LEVEL"? 回答1: Postgres does not have hierarchical queries. No CONNECT BY , therefore also no LEVEL . The additional module tablefunc provides the function connectby() doing almost the same. See: What is the equivalent PostgreSQL syntax to Oracle's CONNECT BY ... START WITH? Or you can do similar things with a standard recursive CTE and a level column that's incremented with every