Closed Farnsi closed 1 month ago
drizzle-orm
0.30.10
drizzle-kit
0.21.4
Union with an "AS" field will not return the field or the fixed value.
mySql.unionAll( db.select({ name: table1.name, imageId: table1.imageId }).from(table1), db.select({ name: table2.name, imageId: sql.raw(`4711`).as('image_id') }).from(table2), )
The generated SQL is correct:
( SELECT `name`, `image_id` FROM `table1` ) UNION ALL ( SELECT `name`, 4711 AS `image_id` FROM `table2` );
The result is:
[{ "name": "a name'" }, { "name": "other name'" }]
[{ "name": "a name'", "imageId": 1 }, { "name": "other name'" "imageId": 4711 }]
No response
Works, had a wrong typo.
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.4
Describe the Bug
Union with an "AS" field will not return the field or the fixed value.
The generated SQL is correct:
The result is:
Expected behavior
Environment & setup
No response