Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
26413: backport-2.0: sql: properly mark current_date as impure r=knz a=knz

Back-port of a small fix contained in cockroachdb#26370 for cockroachdb#26354.

cc @cockroachdb/release 


Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
craig[bot] and knz committed Jun 5, 2018
2 parents 55ea3cb + b080b70 commit 822858a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/sql/sem/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@ CockroachDB supports the following flags:

"current_date": {
tree.Builtin{
Impure: true,
Types: tree.ArgTypes{},
ReturnType: tree.FixedReturnType(types.Date),
Fn: func(ctx *tree.EvalContext, args tree.Datums) (tree.Datum, error) {
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/sem/tree/normalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func TestNormalizeExpr(t *testing.T) {
{`s=lower('FOO')`, `s = 'foo'`},
{`lower(s)='foo'`, `lower(s) = 'foo'`},
{`random()`, `random()`},
{`current_date()`, `current_date()`},
{`a=count('FOO') OVER ()`, `a = count('FOO') OVER ()`},
{`9223372036854775808`, `9223372036854775808`},
{`-9223372036854775808`, `-9223372036854775808`},
Expand Down

0 comments on commit 822858a

Please sign in to comment.