Comments (8)
A simpler test case is:
select a as b from t1 having b > 4;
mysql gives
empty set
but TiDB gives
+---+
| b |
+---+
| 2 |
| 4 |
| 4 |
+---+
from tidb.
@xwb1989 Thanks for report.
Yes, that is a problem.
I will fix it later.
from tidb.
Following is problematic in HavingRset.CheckAndUpdateSelectList
, :
if field.ContainFieldName(name, selectList.ResultFields, field.OrgFieldNameFlag) {
continue
}
if field.ContainFieldName(name, selectList.ResultFields, field.FieldNameFlag) {
if field.ContainFieldName(name, tableFields, field.OrgFieldNameFlag) {
selectList.CloneHiddenField(name, tableFields)
}
continue
}
not having enough time to really dig into yet, but commenting out
if field.ContainFieldName(name, tableFields, field.OrgFieldNameFlag) {
selectList.CloneHiddenField(name, tableFields)
}
Can solve this particular problem(but might break others :(
Just FYI
from tidb.
@xwb1989
Thanks for your suggestion.
We used hidden fields for having fields which not in select or group by fields, and we have not distinguished aggregate and none aggregate fields, so we have the problem as @siddontang mentioned.
As for select a as b from t1 having b > 4;
, because some having conditions has some confused results, like select a as b from t1 having b + 1
or select a as b from t1 having a + b
or select a + b as b from t1 having a + b > 0
and so on, now we only process alias field as origin field first, so select a as b from t1 having b > 4;
may equal to select a from (select a, b from t1 having b > 4) c;
.
Later we will discuss and fix this problem.
Thanks again.
from tidb.
@xwb1989
We have fixed this problem, u can update master branch and have a try:)
from tidb.
Thank you for letting me know :)
from tidb.
I could confirm that the test cases mentioned above is passing.
from tidb.
Cool @xwb1989
from tidb.
Related Issues (20)
- The predicate columns feature relies on `tidb_persist_analyze_options`
- backup br stuck waiting for any response from TiKV
- Resolve the chaos usage of `Constant` HOT 4
- "ERROR 8121 (HY000): privilege check for 'Select' fail" occurs with an UPDATE statement that includes a CTE HOT 2
- Query returns error if using plan cache
- Query with `CONV` expression gives incorrect result if using plan cache
- Unexpected Result with NATURAL RIGHT JOIN and Bitwise NOT HOT 2
- flaky test TestSyncJobSchemaVerLoop
- make bench-daily get empty data for BenchmarkXXXPartitionXXX HOT 1
- release-7.5 branch bump https://github.com/pingcap/errors to the latest commit hash
- br backup always running but can not finish after network partition recover of br node HOT 1
- ttl: Make the default value of ttl job interval as a const
- tidb report redirect failed error HOT 2
- nightly br always occurs oom where restore 1M tables HOT 1
- br restore splits too much regions if there are too many small tables whose data size is less than region size. HOT 1
- Add `EvalContext` argument for `Expression.GetType` and `ParamMarker.GetUserVar`
- Enable parallel sort HOT 1
- DATA RACE executor/sortexec.(*topNChunkHeap).init() HOT 3
- DDL cancellation stalled by DML: Expecting lock indication in mysql.tidb_mdl_view HOT 2
- tidb log print "connection running loop panic [err="Trying to start aggressive locking while it's already started"] " when run tpcc and import into HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tidb.