Another case where I’m trying to take advantage of my previous SQL knowledge but it fails when I try to apply to GSQL.
The LIKE documentation doesn’t have any relevant (to me) examples (using SELECT
and WHERE
), but it seem straightforward. It describes LIKE in a similar way to other SQL languages. (It’s also very hard to google for LIKE, since it’s a common English word, so maybe I missed an explanation on the internet.)
In fact, this page has the hopeful tip:
Tip: The operators listed in this section are designed to behave like the operators in MySQL.
This simple comparison expression works:
SELECT * FROM person WHERE name =< "Bob" limit 3
but this unexpectedly fails:
SELECT * FROM person WHERE name LIKE "Bob%"
Encountered " "like" "LIKE "" at line 1, column 34.
Was expecting one of:
"<" ...
">" ...
"." ...
"!=" ...
"==" ...
"<=" ...
">=" ...
(I also am confused by " "like" "LIKE ""
in the error message, since I’m using LIKE only once.)
What further confuses me, is that this list of expected operators doesn’t include IS
, IS NOT
, or IN
even those are included in the documentation for Expressions. (I did see somebody posted elsewhere that IN
doesn’t work.)
So, IS NULL
fails in the same way:
SELECT * FROM person WHERE name IS NULL
I suspect that maybe I’m misapplying the documentation Operators, Functions, and Expressions to the WHERE
clause, but that just seems odd, since other SQL languages do support that.
I’m very unclear what I’m getting wrong.