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
With the columns query parameter, the All object keys must match error message is avoided. Instead the direct PostgreSQL error is shown, which is more helpful for debugging.
Example:
// When making a bulk insertconst{ data, error }=awaitsupabase.from('mytable').insert([{field: 'val2',nonNullableField: 'val3'},{field: 'val1'}])// Right now this happensconsole.log(error);{message: 'All object keys must match'}// If we were to use the columns query param, we'd get a clearer errorconsole.log(error);{"code": "23502","details": "Failing row contains (val1, null).","hint": null,"message": "null value in column \"nonNullableField\" violates not-null constraint"}
Note: This doesn't solve #173 because the default value of the columns won't be applied. It would still clear the error message though.
Possible implementation
Is not necessary to add a new method to the lib. Internally, the body of the bulk insert can be passed through a function that gets the keys and produces the columns query param.
Something like:
letbody=[{field: 'val2',nonNullableField: 'val3'},{field: 'val1',anotherField: 'val4'}];// Using https://ramdajs.com/letcolumns=R.join(',',R.uniq(R.flatten(R.map(R.keys,body))));console.log(columns);"field,nonNullableField,anotherField"// append this to ?columns= in the http request
The text was updated successfully, but these errors were encountered:
Feature request
With the columns query parameter, the
All object keys must match
error message is avoided. Instead the direct PostgreSQL error is shown, which is more helpful for debugging.Example:
Note: This doesn't solve #173 because the default value of the columns won't be applied. It would still clear the error message though.
Possible implementation
Is not necessary to add a new method to the lib. Internally, the body of the bulk insert can be passed through a function that gets the keys and produces the
columns
query param.Something like:
The text was updated successfully, but these errors were encountered: