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
I have a PostgreSQL table with a varchar[N] column, where N is a fixed number. sqlx prepare detects this as a varchar, and I can accidentily exceed N when inserting into the column, even with a fixed string with a length known at compile time.
I guess we can't always catch this at compile time when using String inputs, because we won't know how long the string is until runtime, but it's a shame this class of error is completely undetectable at compile time at present.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a PostgreSQL table with a
varchar[N]column, whereNis a fixed number.sqlx preparedetects this as avarchar, and I can accidentily exceedNwhen inserting into the column, even with a fixed string with a length known at compile time.I guess we can't always catch this at compile time when using
Stringinputs, because we won't know how long the string is until runtime, but it's a shame this class of error is completely undetectable at compile time at present.Could we do better?
Beta Was this translation helpful? Give feedback.
All reactions