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
|
function mergeQueries(queries: QueryWithTypings[]): QueryWithTypings { |
. This results in failed inserts and selects. In particular if the following if mergeQueries receives the following:
[
{ "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
What version of
drizzle-ormare you using?0.30.1
What version of
drizzle-kitare 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
mergeQueriesfunction insql.tsdrizzle-orm/drizzle-orm/src/sql/sql.ts
Line 69 in 0ddab65
This results in
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?
Environment & setup
No response