Skip to content

Commit 1014c73

Browse files
committed
Add new test case
1 parent 44b51bc commit 1014c73

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
component extends="tests.resources.ModuleIntegrationSpec" {
2+
3+
function run() {
4+
describe("HasManyThrough subselect alias bug regression", function() {
5+
it("uses the correct alias for parent table in subselects (no raw table name)", function() {
6+
// Setup tables and data as in the bug report
7+
getInstance("A").initTable();
8+
getInstance("B").initTable();
9+
getInstance("C").initTable();
10+
getInstance("D").initTable();
11+
12+
queryExecute("""
13+
insert into rmme_d(dID, dValue) values (42, 'some value in table D');
14+
insert into rmme_a (aID) values (1);
15+
insert into rmme_b (bID, aID) values (2, 1);
16+
insert into rmme_c (cID, bID, dID) values (3, 2, 42);
17+
""");
18+
19+
// This should not throw: The multi-part identifier "rmme_C.dID" could not be bound.
20+
var v = getInstance("A").asMemento(includes = ["Cs"]).get();
21+
expect(v).notToBeNull();
22+
expect(v[1]["Cs"]).notToBeNull();
23+
expect(v[1]["Cs"][1]["inlined_dValue"]).toBe("some value in table D");
24+
});
25+
});
26+
}
27+
}

0 commit comments

Comments
 (0)