Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
26067: distsql: blacklist CURRENT_SCHEMA r=RaduBerinde a=RaduBerinde

Blacklist builtins that use `EvalContext.Planner`.

Release note: None

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
  • Loading branch information
craig[bot] and RaduBerinde committed May 25, 2018
2 parents fffe51e + 6d730f2 commit f263cf9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 8 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/builtin_function
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,14 @@ SELECT CURRENT_SCHEMAS(false)
----
{"public"}

# Force the function to be evaluated at execution time and verify it doesn't
# break when distsql is on.
query T
SELECT CURRENT_SCHEMAS(x) FROM (VALUES (true), (false)) AS t(x);
----
{"pg_catalog","public"}
{"public"}

statement ok
SET SEARCH_PATH=test,pg_catalog

Expand Down
14 changes: 8 additions & 6 deletions pkg/sql/sem/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -2305,9 +2305,10 @@ may increase either contention or retry errors, or both.`,
// SQL client against a pg server.
"current_schema": {
tree.Builtin{
Types: tree.ArgTypes{},
ReturnType: tree.FixedReturnType(types.String),
Category: categorySystemInfo,
Types: tree.ArgTypes{},
ReturnType: tree.FixedReturnType(types.String),
Category: categorySystemInfo,
DistsqlBlacklist: true,
Fn: func(evalCtx *tree.EvalContext, args tree.Datums) (tree.Datum, error) {
ctx := evalCtx.Ctx()
curDb := evalCtx.SessionData.Database
Expand Down Expand Up @@ -2336,9 +2337,10 @@ may increase either contention or retry errors, or both.`,
// server.
"current_schemas": {
tree.Builtin{
Types: tree.ArgTypes{{"include_pg_catalog", types.Bool}},
ReturnType: tree.FixedReturnType(types.TArray{Typ: types.String}),
Category: categorySystemInfo,
Types: tree.ArgTypes{{"include_pg_catalog", types.Bool}},
ReturnType: tree.FixedReturnType(types.TArray{Typ: types.String}),
Category: categorySystemInfo,
DistsqlBlacklist: true,
Fn: func(evalCtx *tree.EvalContext, args tree.Datums) (tree.Datum, error) {
ctx := evalCtx.Ctx()
curDb := evalCtx.SessionData.Database
Expand Down

0 comments on commit f263cf9

Please sign in to comment.