tink_sql icon indicating copy to clipboard operation
tink_sql copied to clipboard

.where(table.field == null) translated to "WHERE false"

Open kevinresol opened this issue 8 years ago • 5 comments

Looks like compiler is doing the job. Because the expr was already EConst(false) when it reaches the formatter

kevinresol avatar Apr 26 '17 14:04 kevinresol

Hmm, can you try putting a @:notNull on Field?

back2dos avatar Apr 26 '17 15:04 back2dos

Seems no effect. Added a failing test btw

kevinresol avatar Apr 26 '17 15:04 kevinresol

Hmm, can you try putting a @:notNull on Field?

Since the comparison is false, shouldn't it be something like @:canBeNull instead? Maybe we should add table.field.isNull() instead...

kevinresol avatar May 22 '17 03:05 kevinresol

Well, for the time being that would work, although we need to get == to work to avoid people running into this issue.

back2dos avatar May 22 '17 04:05 back2dos

for reference: https://github.com/haxetink/tink_sql/commit/5ccc214a7859779189ec6e463577f78786709fe5 (added isNull())

kevinresol avatar Jun 29 '17 16:06 kevinresol