mirror of
https://github.com/pgsty/minio.git
synced 2026-07-21 13:10:22 +03:00
Fix precendence bug in S3Select SQL IN clauses (#18708)
Fixes a precendence issue in SQL Select where `a in b and c = 3` was parsed as `a in (b and c = 3)`. Fixes #18682
This commit is contained in:
committed by
GitHub
parent
8bd4f6568b
commit
496027b589
@@ -109,6 +109,21 @@ func TestJSONQueries(t *testing.T) {
|
||||
query: `SELECT * from s3object s WHERE 'bar' in s.synonyms[*]`,
|
||||
wantResult: `{"id":0,"title":"Test Record","desc":"Some text","synonyms":["foo","bar","whatever"]}`,
|
||||
},
|
||||
{
|
||||
name: "in-expression-precedence-1",
|
||||
query: "select * from s3object s where 'bar' in s.synonyms and s.id = 0",
|
||||
wantResult: `{"id":0,"title":"Test Record","desc":"Some text","synonyms":["foo","bar","whatever"]}`,
|
||||
},
|
||||
{
|
||||
name: "in-expression-precedence-2",
|
||||
query: "select * from s3object s where 'some' in ('somex', s.synonyms[0]) and s.id = 1",
|
||||
wantResult: `{"id":1,"title":"Second Record","desc":"another text","synonyms":["some","synonym","value"]}`,
|
||||
},
|
||||
{
|
||||
name: "in-expression-with-aggregation",
|
||||
query: "select SUM(s.id) from s3object s Where 2 in s.numbers[*] or 'some' in s.synonyms[*]",
|
||||
wantResult: `{"_1":3}`,
|
||||
},
|
||||
{
|
||||
name: "bignum-1",
|
||||
query: `SELECT id from s3object s WHERE s.id <= 9223372036854775807`,
|
||||
|
||||
Reference in New Issue
Block a user