Closed darkgnotic closed 3 months ago
Yes, that's expected, and v4 will most likely drop any kind of lazy js inference completely as it is was a bad idea in the first place.
Check out https://github.com/porsager/postgres/pull/392
For your example you'd solve it like this:
WITH bar (id) AS (VALUES (${1}::int)) SELECT * FROM bar
Thank you for the quick response and workaround! 🙏
For a select query with a parameter, an integer value is correctly identified as an
INT4
(type = 23):However, for a query over a VALUES table, the same parameterized value is identified as
TEXT
(type = 25):And the result is similarly incorrect (
{ id: '1' }
).Is this expected, and if so, is there a way to infer the value type from the JavaScript type?