github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/logictest/testdata/logic_test/jobs (about) 1 # 3node-tenant fails due to AUTO STATS being returned in SHOW JOBS. Changing 2 # the cluster setting to disable auto stats doesn't work: 3 # https://github.com/cockroachdb/cockroach/issues/47918 4 5 # These test verify that a user's job are visible via 6 # crdb_internal.jobs and SHOW JOBS. 7 8 user root 9 10 statement ok 11 GRANT ALL ON DATABASE test TO testuser 12 13 statement ok 14 CREATE TABLE t(x INT); INSERT INTO t(x) VALUES (1); CREATE INDEX ON t(x) 15 16 # The "updating privileges" clause in the SELECT statement is for excluding jobs 17 # run by an unrelated startup migration. 18 # TODO (lucy): Update this if/when we decide to change how these jobs queued by 19 # the startup migration are handled. 20 query TTT 21 SELECT job_type, description, user_name FROM [SHOW JOBS] WHERE description != 'updating privileges' 22 ---- 23 SCHEMA CHANGE CREATE INDEX ON test.public.t (x) root 24 25 # The "updating privileges" clause in the SELECT statement is for excluding jobs 26 # run by an unrelated startup migration. 27 # TODO (lucy): Update this if/when we decide to change how these jobs queued by 28 # the startup migration are handled. 29 query TTT 30 SELECT job_type, description, user_name FROM crdb_internal.jobs WHERE description != 'updating privileges' 31 ---- 32 SCHEMA CHANGE CREATE INDEX ON test.public.t (x) root 33 34 user testuser 35 36 # a non-admin user cannot see the admin jobs 37 38 query TTT 39 SELECT job_type, description, user_name FROM [SHOW JOBS] 40 ---- 41 42 query TTT 43 SELECT job_type, description, user_name FROM crdb_internal.jobs 44 ---- 45 46 # However they can see their own jobs. 47 48 statement ok 49 CREATE TABLE u(x INT); INSERT INTO u(x) VALUES (1); CREATE INDEX ON u(x); 50 51 52 # The "updating privileges" clause in the SELECT statement is for excluding jobs 53 # run by an unrelated startup migration. 54 # TODO (lucy): Update this if/when we decide to change how these jobs queued by 55 # the startup migration are handled. 56 query TTT 57 SELECT job_type, description, user_name FROM [SHOW JOBS] WHERE description != 'updating privileges' 58 ---- 59 SCHEMA CHANGE CREATE INDEX ON test.public.u (x) testuser 60 61 # The "updating privileges" clause in the SELECT statement is for excluding jobs 62 # run by an unrelated startup migration. 63 # TODO (lucy): Update this if/when we decide to change how these jobs queued by 64 # the startup migration are handled. 65 query TTT 66 SELECT job_type, description, user_name FROM crdb_internal.jobs WHERE description != 'updating privileges' 67 ---- 68 SCHEMA CHANGE CREATE INDEX ON test.public.u (x) testuser 69 70 # And root can see both. 71 72 user root 73 74 # The "updating privileges" clause in the SELECT statement is for excluding jobs 75 # run by an unrelated startup migration. 76 # TODO (lucy): Update this if/when we decide to change how these jobs queued by 77 # the startup migration are handled. 78 query TTT 79 SELECT job_type, description, user_name FROM [SHOW JOBS] WHERE description != 'updating privileges' 80 ---- 81 SCHEMA CHANGE CREATE INDEX ON test.public.t (x) root 82 SCHEMA CHANGE CREATE INDEX ON test.public.u (x) testuser 83 84 # The "updating privileges" clause in the SELECT statement is for excluding jobs 85 # run by an unrelated startup migration. 86 # TODO (lucy): Update this if/when we decide to change how these jobs queued by 87 # the startup migration are handled. 88 query TTT 89 SELECT job_type, description, user_name FROM crdb_internal.jobs WHERE description != 'updating privileges' 90 ---- 91 SCHEMA CHANGE CREATE INDEX ON test.public.t (x) root 92 SCHEMA CHANGE CREATE INDEX ON test.public.u (x) testuser