Replies: 4 comments 5 replies
-
Hi, thanks for adding this idea, I will try take this as a first time contributor. To verify the assumptions, INVARIANT function will return true when the condition is true. Does that sound good? |
Beta Was this translation helpful? Give feedback.
-
It might actually make more sense to do a simpler "ERROR()" function. INVARIANT can easily be built on top of that. But as mentioned, the hard part is making sure ERROR() is conditionally evaluated Example from bigquery https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging_functions |
Beta Was this translation helpful? Give feedback.
-
Relevant branch of the ozdemircs: |
Beta Was this translation helpful? Give feedback.
-
The select error('my error message'); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why do you want this feature?
Sometimes you want to force SQL execution to stop with a helpful error. eg. if there's some unexpected quality of the data
Example
This will output a NULL or NAN which I have to handle later
Instead, I'd like to be able to do something like
Which would give me a helpful error message and make it so I don't have to handle the somewhat unpredictable behavior of what happens if 1/0.
Beta Was this translation helpful? Give feedback.
All reactions