-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of drizzle-orm are you using?
0.30.1
What version of drizzle-kit are you using?
0.20.14
Describe the Bug
When using AwsDataApi pg driver which actually makes use of the type hints, there has been a bunch of queries that have resulted in mismatched hints. I have narrowed down the issue to the mergeQueries function in sql.ts
drizzle-orm/drizzle-orm/src/sql/sql.ts
Line 69 in 0ddab65
| function mergeQueries(queries: QueryWithTypings[]): QueryWithTypings { |
[
{ "sql": "(", "params": [] },
{ "sql": "default", "params": [] },
{ "sql": ", ", "params": [] },
{
"sql": ":1",
"params": ["44562697-0b70-479c-8f38-f4ff9d17c537"],
"typings": ["uuid"]
},
{ "sql": ", ", "params": [] },
{
"sql": ":2",
"params": ["value_2"]
},
{ "sql": ", ", "params": [] },
{ "sql": ":3", "params": ["value_3"] },
{ "sql": ", ", "params": [] },
{
"sql": ":4",
"params": ["{\"status\":\"enabled\"}"],
"typings": ["json"]
},
{ "sql": ", ", "params": [] },
{ "sql": "default", "params": [] },
{ "sql": ", ", "params": [] },
{ "sql": "default", "params": [] },
{ "sql": ", ", "params": [] },
{ "sql": "default", "params": [] },
{ "sql": ")", "params": [] }
]
This results in
{
"sql": "(default, :1, :2, :3, :4, default, default, default)",
"params": [
"44562697-0b70-479c-8f38-f4ff9d17c537",
"value_2",
"value_3",
"{\"status\":\"enabled\"}"
],
"typings": ["uuid", "json"]
}
Which has the typings indexes incorrect for when they are used later on by the dataapi session driver.
Expected behavior
Expected the result from merge queries to be similar to this, or potentially but would require more work is making it such that the typings stick with the params?
{
"sql": "(default, :1, :2, :3, :4, default, default, default)",
"params": [
"44562697-0b70-479c-8f38-f4ff9d17c537",
"value_2",
"value_3",
"{\"status\":\"enabled\"}"
],
"typings": ["uuid",undefined, undefined, "json"]
}
Environment & setup
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working