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:Jump to solution
No, conditional CTEs are not possible. But you could construct your CTE so that it doesn't do anything based on some input.
2 Replies