-
-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
Test language=MySQL
Description
I found it difficult to handle the logic that Function::Coalesce
supports the coexistence of SimpleExpr
and QueryStatement
The following logic is correct
create table bakery (
id bigint,
name varchar(255),
profit_margin bigint
)
create table cake{
id bigint,
name varchar(255),
price bigint,
bakery_id bigint,
gluten_free bigint,
serial bigint
}
mysql query:
select
name,
bakery,
EXISTS ( SELECT 1 FROM `cake` WHERE `id` = 1 ) AS `exist`,
-- Coalesce not only support SimpleExpr, logic is correct
COALESCE (
-- QueryStatement
( SELECT count(*) FROM `cake` WHERE `bakery_id` = 27 ),
-- SimpleExpr, select or const
(SELECT 0),
0
) AS `count`
from bakery
where id = 27
but the existing logic does not support the coexistence of SimpleExpr
and QueryStatement
Lines 430 to 435 in 28cf151
pub fn coalesce<I>(args: I) -> FunctionCall | |
where | |
I: IntoIterator<Item = SimpleExpr>, | |
{ | |
FunctionCall::new(Function::Coalesce).args(args) | |
} |
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers
Type
Projects
Status
Triage