@@ -19,8 +19,10 @@ shared_ptr<value_expr> value_expr::factory(prod *p, sqltype *type_constraint)
19
19
try {
20
20
if (1 == d20 () && p->level < d6 () && window_function::allowed (p))
21
21
return make_shared<window_function>(p, type_constraint);
22
- else if (1 == d20 () && p->level < d6 ())
22
+ else if (1 == d42 () && p->level < d6 ())
23
23
return make_shared<coalesce>(p, type_constraint);
24
+ else if (1 == d42 () && p->level < d6 ())
25
+ return make_shared<nullif>(p, type_constraint);
24
26
else if (d9 ()<3 && p->level < d6 ())
25
27
return make_shared<funcall>(p, type_constraint);
26
28
else if (d6 ()<3 )
@@ -156,7 +158,8 @@ comparison_op::comparison_op(prod *p) : bool_binop(p)
156
158
}
157
159
}
158
160
159
- coalesce::coalesce (prod *p, sqltype *type_constraint) : value_expr(p)
161
+ coalesce::coalesce (prod *p, sqltype *type_constraint, const char *abbrev)
162
+ : value_expr(p), abbrev_(abbrev)
160
163
{
161
164
auto first_expr = value_expr::factory (this , type_constraint);
162
165
auto second_expr = value_expr::factory (this , first_expr->type );
@@ -177,7 +180,7 @@ coalesce::coalesce(prod *p, sqltype *type_constraint) : value_expr(p)
177
180
178
181
void coalesce::out (std::ostream &out)
179
182
{
180
- out << " cast(coalesce (" ;
183
+ out << " cast(" << abbrev_ << " (" ;
181
184
for (auto expr = value_exprs.begin (); expr != value_exprs.end (); expr++) {
182
185
out << **expr;
183
186
if (expr+1 != value_exprs.end ())
0 commit comments