Skip to content

sql: convert NULL to false#3544

Merged
madelynnblue merged 1 commit intocockroachdb:masterfrom
madelynnblue:sql-null-false
Dec 30, 2015
Merged

sql: convert NULL to false#3544
madelynnblue merged 1 commit intocockroachdb:masterfrom
madelynnblue:sql-null-false

Conversation

@madelynnblue
Copy link
Copy Markdown
Contributor

Matches behavior of postgres, which returns 2 for:

select case when null then 1 else 2 end;

Where previously we would exit with:

query error: cannot convert NULL to bool

Review on Reviewable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compare directly to DNull and add a simple test

@petermattis
Copy link
Copy Markdown
Collaborator

This PR needs an associated test.

Matches behavior of postgres, which returns 2 for:

select case when null then 1 else 2 end;

Where previously we would exit with:

query error: cannot convert NULL to bool
@madelynnblue
Copy link
Copy Markdown
Contributor Author

Test added.


Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion.


sql/parser/datum.go, line 91 [r1] (raw file):
Done.


Comments from the review on Reviewable.io

@petermattis
Copy link
Copy Markdown
Collaborator

LGTM

madelynnblue added a commit that referenced this pull request Dec 30, 2015
@madelynnblue madelynnblue merged commit f52721f into cockroachdb:master Dec 30, 2015
@madelynnblue madelynnblue deleted the sql-null-false branch December 30, 2015 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants