LIMIT on a join between virtual catalog tables returns 0 rows #200
Copy link
Copy link
Closed
Labels
area:pgwirePostgreSQL wire protocol / client compatPostgreSQL wire protocol / client compatarea:sqlParser, planner, SQL semanticsParser, planner, SQL semanticssev:2-highMajor functionality broken; no acceptable workaroundMajor functionality broken; no acceptable workaroundtype:bugA defect — broken, incorrect, or lost dataA defect — broken, incorrect, or lost data
Description
Activity
- addedstatus:needs-triageAwaiting maintainer triage (severity + priority)Awaiting maintainer triage (severity + priority)
on Jul 21, 2026 - addedtype:bugA defect — broken, incorrect, or lost dataA defect — broken, incorrect, or lost datasev:2-highMajor functionality broken; no acceptable workaroundMajor functionality broken; no acceptable workaroundarea:sqlParser, planner, SQL semanticsParser, planner, SQL semanticsarea:pgwirePostgreSQL wire protocol / client compatPostgreSQL wire protocol / client compatand removedstatus:needs-triageAwaiting maintainer triage (severity + priority)Awaiting maintainer triage (severity + priority)
on Jul 22, 2026
Metadata
Metadata
Assignees
Labels
area:pgwirePostgreSQL wire protocol / client compatPostgreSQL wire protocol / client compatarea:sqlParser, planner, SQL semanticsParser, planner, SQL semanticssev:2-highMajor functionality broken; no acceptable workaroundMajor functionality broken; no acceptable workaroundtype:bugA defect — broken, incorrect, or lost dataA defect — broken, incorrect, or lost data
Version / build tested against
origin/main @ 74febcf80Deployment mode
Origin — single node (local)
Engine(s) involved
Not engine-specific / unsure
Summary
A query joining two virtual pg_catalog tables returns the correct rows — until a
LIMITclause is added, at which point the same query silently returns 0 rows. Real (user) collections joined with LIMIT are unaffected; the failure is specific to the virtual catalog evaluator. Any catalog introspection that pages with LIMIT silently sees an empty catalog.Steps to reproduce
Expected behavior
LIMIT ntruncates a result set to at most n rows; it never empties a non-empty result. Catalog joins behave like collection joins.Actual behavior
Catalog-to-catalog joins return 0 rows whenever a LIMIT clause is present; the identical query without LIMIT returns the correct rows. Single-table catalog queries with LIMIT are fine, and collection joins with LIMIT are fine.
What actually happened? (check all that are true)
Proposed severity
SEV-2 — High: major functionality broken or silently-wrong results; stored data intact
Reproducibility
Always — every attempt
Last known-good version / commit (if a regression)
(blank — catalog joins only recently became usable, so this shape may never have worked with LIMIT)
Environment & logs
Linux x86_64, release build, fresh data directory. Statements succeed silently — no server log lines. Best guess: the virtual-catalog evaluator applies LIMIT before (or instead of) materializing the join output.
Before submitting
mainbuild (not a stale local branch).