Make group_concat nullable

This commit is contained in:
Simon Binder 2021-12-29 11:36:23 +01:00
parent bce13f150f
commit bdf0dc9985
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
2 changed files with 5 additions and 1 deletions

View File

@ -455,6 +455,7 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
ResolvedType? _resolveInvocation(ExpressionInvocation e) {
final params = e.expandParameters();
void nullableIfChildIs() {
session._addRelation(NullableIfSomeOtherIs(e, params));
}
@ -484,9 +485,10 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
case 'substr':
case 'trim':
case 'upper':
case 'group_concat':
nullableIfChildIs();
return _textType;
case 'group_concat':
return _textType.withNullable(true);
case 'date':
case 'time':
case 'datetime':

View File

@ -42,6 +42,8 @@ const Map<String, ResolvedType?> _types = {
ResolvedType.bool(),
'INSERT INTO demo DEFAULT VALUES ON CONFLICT DO UPDATE SET id = id WHERE ?':
ResolvedType.bool(),
'SELECT GROUP_CONCAT(content) = ? FROM demo;':
ResolvedType(type: BasicType.text, nullable: true),
};
SqlEngine _spawnEngine() {