-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
bugSomething isn't workingSomething isn't workingcqn4sqlall issues related to db-service/cqn4sqlall issues related to db-service/cqn4sql
Description
Given the following query:
> q = cds.ql`SELECT from (SELECT from (select from ${Books} as inner { author } ) as mid ) as outer where author = 42`
cds.ql {
SELECT: {
from: {
SELECT: {
from: {
SELECT: {
from: { ref: [ 'sap.capire.bookshop.Books' ], as: 'inner' },
columns: [ { ref: [ 'author' ] } ]
},
as: 'mid'
}
},
as: 'outer'
},
where: [ { ref: [ 'author' ] }, '=', { val: 42 } ]
}
}the forSQL transformation misses bubbling up the foreign key from the innermost selects association author:
> q.forSQL()
cds.ql {
SELECT: {
from: {
SELECT: {
from: {
SELECT: {
from: { ref: [ 'sap.capire.bookshop.Books' ], as: 'inner' },
columns: [ { ref: [ 'inner', 'author_ID' ] } ]
},
as: 'mid'
},
columns: []
},
as: 'outer'
},
where: [ { ref: [ 'outer', 'author_ID' ] }, '=', { val: 42 } ],
columns: []
}
}→ This is due to a mechanism which prevents us from duplicating a foreign key for a wildcard select. This case kicks in if we have a flat CSN, which contains an association and it's foreign key. However, in this case, it does only hold the association, hence we should flatten the association.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcqn4sqlall issues related to db-service/cqn4sqlall issues related to db-service/cqn4sql