K
Kysely7mo ago
lorentz

are conditional CTEs possible?

i don't find any hints here https://kysely.dev/docs/category/cte. i have tried the conditional where approach (https://kysely.dev/docs/examples/WHERE/conditional-where-calls), but i get type error Type 'QueryCreatorWithCommonTableExpression ... The types returned by 'with(...)' are incompatible between these types.
Solution:
No, conditional CTEs are not possible. But you could construct your CTE so that it doesn't do anything based on some input.
Jump to solution
2 Replies
Solution
koskimas
koskimas7mo ago
No, conditional CTEs are not possible. But you could construct your CTE so that it doesn't do anything based on some input.
lorentz
lorentzOP7mo ago
thx! and good suggestion. i shall try to figure it out 👍
Want results from more Discord servers?
Add your server