when using a relation one-to-one, and a filter by id over the main entity,
eg. querying posts with their author.
it seems like drizzle-orm automatically adds a limit: 1 to the join (which makes sense).
but apparently this adds a new param to the query (for that 1) which seems to offset the typeHint of params later.
(where articleTable has a one-to-one relationship with userTable, based on the updatedBy field in articleTable)
here's the failing query:
Query: select "articleTable"."id", "articleTable"."name", "articleTable"."description", "articleTable"."createdAt", "articleTable"."createdBy", "articleTable"."updatedAt", "articleTable"."updatedBy", "articleTable_updatedByUser"."data" as "updatedByUser" from "article" "articleTable" left join lateral (select json_build_array("articleTable_updatedByUser"."name", "articleTable_updatedByUser"."email") as "data" from (select * from "user" "articleTable_updatedByUser" where "articleTable_updatedByUser"."id" = "articleTable"."updatedBy" limit :1) "articleTable_updatedByUser") "articleTable_updatedByUser" on true where "articleTable"."workspace_id" = :2 order by "articleTable"."name" limit :3 -- params: [{"name":"1","value":{"longValue":1},"typeHint":"UUID"}, {"name":"2","value":{"stringValue":"56cc697c-ab59-4ab1-bc34-4bc4013f9dcd"}}, {"name":"3","value":{"longValue":1000}}]
I'm trying to query "articles" within a specific "workspace".
notice that the list of params, on the first index has the 1 used for that automatic limit, and it has a "typeHint":"UUID", which should be on the param 2
What version of
drizzle-orm
are you using?0.28.6
What version of
drizzle-kit
are you using?0.19.13
Describe the Bug
when using a relation one-to-one, and a filter by id over the main entity,
eg. querying posts with their author.
it seems like drizzle-orm automatically adds a
limit: 1
to the join (which makes sense). but apparently this adds a new param to the query (for that1
) which seems to offset the typeHint of params later.the query:
(where articleTable has a one-to-one relationship with userTable, based on the updatedBy field in articleTable)
here's the failing query:
1
used for that automaticlimit
, and it has a"typeHint":"UUID"
, which should be on the param 2Expected behavior
"typeHint":"UUID"
should be on param 2 (not in 1)Environment & setup
I'm using AWS Data API, aurora postgres