haxetink / tink_sql

SQL embedded into Haxe
MIT License
54 stars 17 forks source link

Complex subquery wrongly typed #123

Closed kevinresol closed 3 years ago

kevinresol commented 3 years ago

Modified from the fromSubquery test

public function fromComplexSubquery() {
    return db
        .from({sub: db.Post.select({maxId: max(Post.id), renamed: Post.author}).groupBy(fields -> [fields.author])})
        .join(db.User).on(User.id == sub.renamed)
        .first()
        .next(function(row) {
            return assert(true);
        });
}

Firstly, ExprType is not provided to Field's constructor: https://github.com/haxetink/tink_sql/blob/9922d2d10d12e0cbd941d2235e69078db4eb2b3e/src/tink/sql/macros/Targets.hx#L31

Secondly, compiler complains sub.renamed with Table2_Fields has no field renamed