sql: SHOW JOBS SELECT query should not see the SHOW JOBS columns #121284
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
The following statement runs when it shouldn't:
system.jobs
does not have ajob_id
column.SHOW JOBS
produces ajob_id
column, so this is handled like a correlated subquery.This is not surprising because internally it gets rewritten as a subquery:
cockroach/pkg/sql/delegate/show_jobs.go
Line 76 in 88f311d
The fix might be as easy as changing
(%s)
to[%s]
here. As a reminder[ query ]
is syntactic sugar for a top-levelWITH x AS query
. It might be cleaner to just generate the top-level WITH instead of using[ .. ]
though.Jira issue: CRDB-37172
The text was updated successfully, but these errors were encountered: