File tree Expand file tree Collapse file tree 3 files changed +75
-13
lines changed Expand file tree Collapse file tree 3 files changed +75
-13
lines changed Original file line number Diff line number Diff line change 5907
5907
2
5908
5908
DROP VIEW v1;
5909
5909
DROP TABLE t1;
5910
+ #
5911
+ # MDEV-8642: WHERE Clause not applied on View - Empty result set returned
5912
+ #
5913
+ CREATE TABLE `t1` (
5914
+ `id` int(20) NOT NULL AUTO_INCREMENT,
5915
+ `use_case` int(11) DEFAULT NULL,
5916
+ `current_deadline` date DEFAULT NULL,
5917
+ `ts_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
5918
+ PRIMARY KEY (`id`),
5919
+ UNIQUE KEY `id_UNIQUE` (`id`)
5920
+ ) ENGINE=MyISAM AUTO_INCREMENT=13976 DEFAULT CHARSET=latin1;
5921
+ INSERT INTO `t1` VALUES (1,10,'2015-12-18','2015-08-18 08:38:16');
5922
+ INSERT INTO `t1` VALUES (2,20,'2015-10-18','2015-08-18 08:43:30');
5923
+ CREATE VIEW v1 AS SELECT
5924
+ use_case as use_case_id,
5925
+ (
5926
+ SELECT
5927
+ deadline_sub.current_deadline
5928
+ FROM
5929
+ t1 deadline_sub
5930
+ WHERE
5931
+ deadline_sub.use_case = use_case_id
5932
+ AND ts_create = (SELECT
5933
+ MIN(ts_create)
5934
+ FROM
5935
+ t1 startdate_sub
5936
+ WHERE
5937
+ startdate_sub.use_case = use_case_id
5938
+ )
5939
+ ) AS InitialDeadline
5940
+ FROM
5941
+ t1;
5942
+ SELECT * FROM v1 where use_case_id = 10;
5943
+ use_case_id InitialDeadline
5944
+ 10 2015-12-18
5945
+ drop view v1;
5946
+ drop table t1;
5910
5947
# -----------------------------------------------------------------
5911
5948
# -- End of 10.0 tests.
5912
5949
# -----------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -5775,6 +5775,44 @@ DROP VIEW v1;
5775
5775
5776
5776
DROP TABLE t1;
5777
5777
5778
+ --echo #
5779
+ --echo # MDEV-8642: WHERE Clause not applied on View - Empty result set returned
5780
+ --echo #
5781
+
5782
+ CREATE TABLE `t1` (
5783
+ `id` int(20) NOT NULL AUTO_INCREMENT,
5784
+ `use_case` int(11) DEFAULT NULL,
5785
+ `current_deadline` date DEFAULT NULL,
5786
+ `ts_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
5787
+ PRIMARY KEY (`id`),
5788
+ UNIQUE KEY `id_UNIQUE` (`id`)
5789
+ ) ENGINE=MyISAM AUTO_INCREMENT=13976 DEFAULT CHARSET=latin1;
5790
+ INSERT INTO `t1` VALUES (1,10,'2015-12-18','2015-08-18 08:38:16');
5791
+ INSERT INTO `t1` VALUES (2,20,'2015-10-18','2015-08-18 08:43:30');
5792
+ CREATE VIEW v1 AS SELECT
5793
+ use_case as use_case_id,
5794
+ (
5795
+ SELECT
5796
+ deadline_sub.current_deadline
5797
+ FROM
5798
+ t1 deadline_sub
5799
+ WHERE
5800
+ deadline_sub.use_case = use_case_id
5801
+ AND ts_create = (SELECT
5802
+ MIN(ts_create)
5803
+ FROM
5804
+ t1 startdate_sub
5805
+ WHERE
5806
+ startdate_sub.use_case = use_case_id
5807
+ )
5808
+ ) AS InitialDeadline
5809
+ FROM
5810
+ t1;
5811
+
5812
+ SELECT * FROM v1 where use_case_id = 10;
5813
+
5814
+ drop view v1;
5815
+ drop table t1;
5778
5816
5779
5817
--echo # -----------------------------------------------------------------
5780
5818
--echo # -- End of 10.0 tests.
Original file line number Diff line number Diff line change @@ -7141,19 +7141,6 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
7141
7141
last_checked_context->select_lex ->nest_level );
7142
7142
}
7143
7143
}
7144
- else if (ref_type () != VIEW_REF)
7145
- {
7146
- /*
7147
- It could be that we're referring to something that's in ancestor selects.
7148
- We must make an appropriate mark_as_dependent() call for each such
7149
- outside reference.
7150
- */
7151
- Dependency_marker dep_marker;
7152
- dep_marker.current_select = current_sel;
7153
- dep_marker.thd = thd;
7154
- (*ref)->walk (&Item::enumerate_field_refs_processor, FALSE ,
7155
- (uchar*)&dep_marker);
7156
- }
7157
7144
7158
7145
DBUG_ASSERT (*ref);
7159
7146
/*
You can’t perform that action at this time.
0 commit comments