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

[Bug]: Smart substitution and prepared statements need you to explicitly cast fields #8784

Open
1 task done
Nikhil-Nandagopal opened this issue Oct 25, 2021 · 7 comments
Open
1 task done
Assignees
Labels
Backend This marks the issue or pull request to reference server code Bug Something isn't working Integrations Product Issues related to a specific integration Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage Prepared statements Issues related to prepared statement flow Production Query & JS Pod Issues related to the query & JS Pod

Comments

@Nikhil-Nandagopal
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Users have reported that when working with data types in SQL, JSON and number are impossible to insert without an explicit cast.
Similarly in APIs if an input has a number, the value is always sent as a string.

Steps To Reproduce

  1. Drag an Input widget
  2. Create a postgres query to insert the input value into a table column with integer type
  3. Enter a value and run the query
  4. The query fails unless we cast it to an integer as
Insert into table1 (col1) values ({{Input1.text}} :: Integer)

The same can be reproduced for an API

Environment

Production

Version

Cloud

@Nikhil-Nandagopal Nikhil-Nandagopal added Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Core Query Execution Issues related to the execution of all queries labels Oct 25, 2021
@github-actions github-actions bot added Query & JS Pod Issues related to the query & JS Pod Actions Pod labels Oct 25, 2021
@nidhi-nair nidhi-nair self-assigned this Nov 24, 2021
@sumitsum
Copy link
Contributor

sumitsum commented Nov 26, 2021

@Nikhil-Nandagopal can you please explain what the ask here is ? AFAIK, the reason explicit cast was introduced was because when a number is fed as input, it can be interpreted as both a string and a number, with either case being valid in different scenarios. Is the ask here to auto detect if the number should be casted to an integer or not ?

@Nikhil-Nandagopal
Copy link
Contributor Author

@sumitsum yes the ask is the auto-detect types like JSON and number to automatically cast them

@nidhi-nair nidhi-nair added the Backend This marks the issue or pull request to reference server code label Dec 2, 2021
@Nikhil-Nandagopal Nikhil-Nandagopal added Good First Issue Good for newcomers Test and removed Good First Issue Good for newcomers Test labels Dec 23, 2021
@leotom2000
Copy link
Contributor

Auto-detect of types like JSON and Numbers are happening.
It seems this issue might have been addressed by the following PR's.

PR Author Date
fix: Json smart substitution breaks when evaluated value contains the character '?' #7031 Trisha Anand 02/09/2021
Adding support for JSON object fields in Postgres for Prepared Statement #6761 Trisha Anand 23/8/2021

This issue was raised on 25/10/2021 based on the earlier feedback of some users.
Could be the users experienced this issue before the above PR changes were moved to Production,
or the users could have used the old build without the above updates.

Can this be moved to QA for testing.
@sumitsum @nidhi-nair @trishaanand @ajinkyakulkarni

@nidhi-nair nidhi-nair added the Datatype issue Issues that have risen because data types weren't handled label May 11, 2022
@Nikhil-Nandagopal Nikhil-Nandagopal added smartBSONsubstitution Prepared statements Issues related to prepared statement flow Data Platform Pod Issues related to the underlying data platform and removed smartBSONsubstitution Core Query Execution Issues related to the execution of all queries labels Sep 12, 2022
@sribalajig
Copy link

@subrata71 @btsgh can you please check if this issue is still valid?

@subrata71
Copy link
Contributor

If the target column in the database is of type integer and the input comes from an input widget, then the input widget must be of Number type.
As Postgres is very strict with data types, the user must ensure the value provided to a Postgres column must match the same type.

The issue is not valid considering the above fact.
@sribalajig

@sumitsum
Copy link
Contributor

sumitsum commented Nov 15, 2022

@subrata71 APMU, the ask here could be to look at the column type that we already have and use that type instead of the inferred type. cc: @sribalajig

@subrata71
Copy link
Contributor

This looks like a valid ask for the DB schema project where we are supposed to leverage the information of the underlying schema. @sumitsum

@sribalajig sribalajig added Core Query Execution Issues related to the execution of all queries and removed Datatype issue Issues that have risen because data types weren't handled labels Nov 16, 2022
@sribalajig sribalajig added Low An issue that is neither critical nor breaks a user flow and removed High This issue blocks a user from building or impacts a lot of users labels Jan 27, 2023
@nidhi-nair nidhi-nair added the Needs Triaging Needs attention from maintainers to triage label Apr 2, 2024
@github-actions github-actions bot added the Integrations Product Issues related to a specific integration label Apr 2, 2024
@riteshkew riteshkew removed the Core Query Execution Issues related to the execution of all queries label Apr 8, 2024
@github-actions github-actions bot removed the Data Platform Pod Issues related to the underlying data platform label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend This marks the issue or pull request to reference server code Bug Something isn't working Integrations Product Issues related to a specific integration Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage Prepared statements Issues related to prepared statement flow Production Query & JS Pod Issues related to the query & JS Pod
Projects
Status: No status
Development

No branches or pull requests