You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To illustrate what I mean (silly example that generates error):
sql` SELECT CONT(id)::int as amount FROM "person" WHERE nationality = ${'UK'} and id = ${1}`
This query fails because of typo and the error has parameters property. When I check this property, I see this:
[{type: 0,value: 'UK'},{type: 0,value: '1'}]
I understand that this is serialized parameters with their data types in Postges but this is not what I passed to sql function. So, it's not fine to log something like this into log file (or even in stack trace) because it confuses. I also cannot map values to value property because then it looks like I passed string '1' to id but I passed a normal number. This becomes even more confusing when we deal with booleans and the value equals to f or t
debug option behaves the same way, I'd like to have a way to get back parameters I passed to sql function without writing additional logic on my end to unserialize all of those
The text was updated successfully, but these errors were encountered:
@porsager we discussed this in gitter but after that I don't see any commits that address this. That's why decided to create an issue, just to keep this in repo
* feat: adds `raw` property to error and debug parameters
Fixes#140
* fix(types): adds `null` as additional type to `Parameter.raw` and `Parameter.value`
Uh oh!
There was an error while loading. Please reload this page.
To illustrate what I mean (silly example that generates error):
This query fails because of typo and the error has
parameters
property. When I check this property, I see this:I understand that this is serialized parameters with their data types in Postges but this is not what I passed to
sql
function. So, it's not fine to log something like this into log file (or even in stack trace) because it confuses. I also cannot map values tovalue
property because then it looks like I passed string'1'
to id but I passed a normal number. This becomes even more confusing when we deal with booleans and the value equals tof
ort
debug
option behaves the same way, I'd like to have a way to get back parameters I passed tosql
function without writing additional logic on my end to unserialize all of thoseThe text was updated successfully, but these errors were encountered: