V8-archive: Failed generating the SQL query in online demo

Created on 1 Jun 2019  Â·  5Comments  Â·  Source: directus/v8-archive

Bug Report

Failed to generate the SQL query in the online demo app, I don't know if this issue is related to demo only

Steps to Reproduce

  1. Go to 'https://directus.app/#/collections/sales/91315'
    or any other items in the sales collection
  2. try increasing Sale Amount field past 10 $
  3. See error
{code: 9, message: "Failed generating the SQL query.", query: "UPDATE `sales` SET `sale_amount` = '10.23', `id` = '91315' WHERE `id` = '91315'"}
bug

All 5 comments

Hello @24js

You are getting this error because of the length of sales_amount set in the collection. Here the precision is 3 and scale is 2. So the max value can be 9.99 only! Thus when you try to update the value with 10 it throws the error. Please update that value from the admin setting.

Issue-996

Thanks @bjgajjar — is there a way to catch this error and have it be friendlier (in the App at least, but hopefully the API too)? Perhaps something like: The value submitted (10) for "Sale Amount" is longer than the field's supported length (3,2). Please submit a shorter value or ask an Admin to increase the length.

@rijkvanzanten 🔔

You are getting this error because of the length of sales_amount set in the collection. Here the precision is 3 and scale is 2. So the max value can be 9.99 only! Thus when you try to update the value with 10 it throws the error. Please update that value from the admin setting.

While this is true, it shouldn't throw a 500 error in that case. Like @benhaynes mentioned, it should throw an error with a description as to why it failed with a 400 status code.

Agreed! Will do that and send the PR! :)

Fixed in #997

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maettyhawk picture maettyhawk  Â·  3Comments

gitlabisbetterthangithub picture gitlabisbetterthangithub  Â·  3Comments

cdwmhcc picture cdwmhcc  Â·  3Comments

ondronix picture ondronix  Â·  3Comments

24js picture 24js  Â·  3Comments