mirror of https://github.com/AMT-Cheif/drift.git
Resolve `unixepoch` SQL function as datetime
This commit is contained in:
parent
5367072df5
commit
c9bd7236c6
|
@ -523,7 +523,6 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
|
|||
case 'datetime':
|
||||
case 'julianday':
|
||||
case 'strftime':
|
||||
case 'unixepoch':
|
||||
case 'char':
|
||||
case 'hex':
|
||||
case 'quote':
|
||||
|
@ -588,6 +587,9 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
|
|||
.._addRelation(CopyEncapsulating(e, params))
|
||||
.._addRelation(HaveSameType(params));
|
||||
return null;
|
||||
case 'unixepoch':
|
||||
return const ResolvedType(
|
||||
type: BasicType.int, nullable: true, hint: IsDateTime());
|
||||
}
|
||||
|
||||
final extensionHandler = _functionHandlerFor(e);
|
||||
|
|
|
@ -52,6 +52,8 @@ const Map<String, ResolvedType?> _types = {
|
|||
"SELECT 'a' ->> ? = 'b'": ResolvedType(type: BasicType.text, nullable: false),
|
||||
'SELECT MAX(id, ?) FROM demo': ResolvedType(type: BasicType.int),
|
||||
'SELECT SUM(id = 2) = ? FROM demo': ResolvedType(type: BasicType.int),
|
||||
"SELECT unixepoch('now') = ?":
|
||||
ResolvedType(type: BasicType.int, nullable: true, hint: IsDateTime()),
|
||||
};
|
||||
|
||||
SqlEngine _spawnEngine() {
|
||||
|
|
Loading…
Reference in New Issue