Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUDI-7444] Queries use blank string instead of column default value when binding default value is empty #11629

Closed
1 task done
abreland-amd opened this issue Aug 30, 2023 · 0 comments
Labels
bb-bindings bug Something isn't working env - production Bug found in production firestorm Data/Infra/Revenue Team linear Medium priority Created by Linear-GitHub Sync

Comments

@abreland-amd
Copy link

abreland-amd commented Aug 30, 2023

Checklist

  • I have searched budibase discussions and github issues to check if my issue already exists

Hosting

  • Self
    • Method: Docker Compose
    • Budibase Version: 2.9.30
    • App Version: 2.9.30

I am using a MySQL 8.0.34 database and one of my tables has the following columns:

But when I create a query and try to insert, using the following SQL/handlebars:

INSERT INTO configs (type, customer_project_id, board_id, vendor_id, build_phase_id, cvl_id)
VALUES ( {{ type }}, {{ customer_project_id }}, {{ board_id}}, {{ vendor_id}}, {{ build_phase_id}}, {{ cvl_id}} );

and the following bindings:

I get an incorrect integer value error, as follows:

I am assuming this is happening because BudiBase is trying to insert an empty string to an int column, because I left some of the binding defaults blank. In my case, those columns are nullable and have a default value of NULL, but since BudiBase is trying to insert an empty string it is getting rejected. Is there any way to use NULL as a default value directly? Or more generally, can BudiBase use the column default value when there is no default value in the binding field?

Notably, BudiBase is able to save the row just fine (And use the column default value of NULL) when I use the 'Save Row' action instead to save this data, instead of building a query.

To Reproduce
Steps to reproduce the behavior:

  1. Create a MySQL database table and add a nullable INT field with a default value of null
  2. Create a new query in BudiBase. Set up a binding for the INT field, but leave the default value blank. In the insert query, use handlebars syntax to refer to the binding ( Ex: INSERT INTO TestTable (NullableIntColumn) VALUES ( {{ NullableIntColumnBinding }} )
  3. Run the query, and observe the error from the above screenshot.

Expected behavior
When no default value is set in the bindings, and no data has been passed to the binding from the app, BudiBase will insert the column default value.

App Export
If possible - please attach an export of your budibase application for debugging/reproduction purposes.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version: 116.0.5845.140

From SyncLinear.com | BUDI-7444

@abreland-amd abreland-amd added the bug Something isn't working label Aug 30, 2023
@melohagan melohagan changed the title Queries use blank string instead of column default value when binding default value is empty [BUDI-7444] Queries use blank string instead of column default value when binding default value is empty Aug 31, 2023
@melohagan melohagan added env - production Bug found in production firestorm Data/Infra/Revenue Team Medium priority Created by Linear-GitHub Sync labels Aug 31, 2023
@melohagan melohagan added this to the v.1 milestone Nov 24, 2023
@melohagan melohagan self-assigned this Nov 24, 2023
@melohagan melohagan removed this from the v.1 milestone Nov 29, 2023
@melohagan melohagan removed their assignment Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bb-bindings bug Something isn't working env - production Bug found in production firestorm Data/Infra/Revenue Team linear Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

3 participants