SQL general: Changes to error messages for subqueries¶
Attention
This behavior change is in the 2026_01 bundle.
For the current status of the bundle, refer to Bundle history.
Error messages for subqueries behave in the following manner:
- Before the change:
When a subquery returns an error, the error message contains no specific information about the SQL code or object.
- After the change:
When some subqueries return an error, the error message contains specific information, such as the following details:
The line and position of the unsupported code in the subquery.
The name of the object, such as a view or function, that contains the unsupported subquery. When objects are nested, the name of the outermost object is returned. For example, if a view with an unsupported subquery is nested in a secure view, the error message shows the name of the secure view.
The name of the type of object, such as a masking policy, that contains the unsupported subquery.
There are no changes to the error codes related to subqueries.
Note
This behavior change doesn’t apply to subqueries in lateral joins or user-defined table functions (UDTFs).
Examples¶
The following examples show changes to the error messages for subqueries.
Create three tables and insert data into each of them:
These tables are used in the following examples:
Unsupported subquery¶
Run an unsupported subquery that returns an error:
This query returns an error because the correlated column a is in the ON clause of a left join.
Before the behavior change, the following error is returned:
After the behavior change, the following error is returned:
Secure view with an unsupported subquery¶
Create a secure view with an unsupported subquery, and query the view:
Before the behavior change, the following error is returned:
After the behavior change, the following error is returned:
Masking policy with an unsupported subquery¶
Create a masking policy with an unsupported subquery, alter a table to use the masking policy, and query the table:
Before the behavior change, the following error is returned:
After the behavior change, the following error is returned:
Ref: 2140