fed
[Bug] innerJoinLateral selectAll prepends schema
apologies for the hastily written bug report. i found a workaround so im not super concerned. writing this down in case it's helpful:
1. have a postgres
db
variable that's instantiated withSchema
pointed at my_schema
2. selectFrom my_table
with an innerJoinLateral
on my_computed_object
3. select jsonObjectFrom(eb.selectFrom('my_computed_object').selectAll('my_computed_object'))
4. compile query and observe: (select to_json(obj) from (select "my_schema"."my_computed_object".* from "my_schema"."my_computed_object") as obj)
the above results in a runtime error because "my_schema"."my_computed_object"
does not exist. the prepended "my_schema".
should get dropped
the workaround is to instead do jsonBuildObject({ key1: ref('key1'), ... })
(feel free to close / ignore this if the above is insufficient / not helpful)17 replies
Flatten type of single column select?
Hi! I have helpers that look roughly like this:
the problem is that i cannot compose these helpers. in other words, i cannot do the following:
because the type of
orgOwnerId
does not match the type of the id
arg required by personName
any suggestions on how to solve this?
somehow "flattening" the return type of ownerId
to Expression<number>
would be ideal, if that's possible
and that 👆 should be valid, since ownerId
is a single-row single-column select? i thought about using $castTo
, but one concern is that $castTo
gives up type safety...4 replies
Improving TS compile speed with multiple conditional selects?
Hi, I have API endpoints that query Postgres via Kysely. The API endpoints accept an
include
object that determines whether to include various optional fields. Some endpoints have grown to accept 5-10 optional fields.
Each of these optional fields results in an additional $if
branch in the Kysely query. And this seems to harm TS compile speed -- I'm now waiting 1-3min for each compilation.
What are the best ways to mitigate the compile speed downsides of using many $if
calls?6 replies