-
-
Notifications
You must be signed in to change notification settings - Fork 579
Closed
dolthub/go-mysql-server
#1352Labels
ORMIssue caused from ORM usageIssue caused from ORM usagebugSomething isn't workingSomething isn't working
Description
Consider the following dump
SET FOREIGN_KEY_CHECKS = 0;
SET AUTOCOMMIT = 0;
DROP TABLE IF EXISTS `tweet`;
CREATE TABLE `tweet` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`content` text NOT NULL,
`timestamp` bigint NOT NULL,
PRIMARY KEY (`id`),
KEY `tweet_user_id` (`user_id`),
CONSTRAINT `0qpfesgd` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `tweet` (`id`,`user_id`,`content`,`timestamp`) VALUES (1,1,'meow',1647463727);
INSERT INTO `tweet` (`id`,`user_id`,`content`,`timestamp`) VALUES (2,1,'purr',1647463727);
INSERT INTO `tweet` (`id`,`user_id`,`content`,`timestamp`) VALUES (3,2,'hiss',1647463727);
INSERT INTO `tweet` (`id`,`user_id`,`content`,`timestamp`) VALUES (4,3,'woof',1647463727);
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `users` (`id`,`username`) VALUES (1,'huey');
INSERT INTO `users` (`id`,`username`) VALUES (2,'zaizee');
INSERT INTO `users` (`id`,`username`) VALUES (3,'mickey');
Consider the following query:
SELECT `t1`.`username`, COUNT(`t1`.`id`) AS `ct` FROM ((SELECT `t2`.`id`, `t2`.`content`, `t3`.`username` FROM `tweet` AS `t2` INNER JOIN `users` AS `t3` ON (`t2`.`user_id` = `t3`.`id`) WHERE (`t3`.`username` = 'u3')) UNION (SELECT `t4`.`id`, `t4`.`content`, `t5`.`username` FROM `tweet` AS `t4` INNER JOIN `users` AS `t5` ON (`t4`.`user_id` = `t5`.`id`) WHERE (`t5`.`username` IN ('u2', 'u4')))) AS `t1` GROUP BY `t1`.`username` ORDER BY COUNT(`t1`.`id`) DESC;
Dolt returns the following error
unable to push plan.Sort node below *plan.Union
Metadata
Metadata
Assignees
Labels
ORMIssue caused from ORM usageIssue caused from ORM usagebugSomething isn't workingSomething isn't working