Bind variables: No longer ignored as parameters for some built-in table functions¶
Attention
This behavior change is in the 2023_08 bundle.
For the current status of the bundle, refer to Bundle History.
In Snowflake Scripting, a driver, or the SQL REST API, you can use bind variables in SQL statements. (For examples of using bind variables, see Using a variable in a SQL statement (binding), Binding data, and Using bind variables in a statement.
This behavior change affects cases in which you pass a bind variable directly as one of the built-in table function arguments listed below. The behavior changes in the following way:
- Before the change:
The bind variable is ignored, and the argument is not passed to the table function.
- AFter the change:
The bind variable is passed as an argument to the table function.
Note that this does not affect cases in which you pass a bind variable to another function before passing the result to a table function argument. For example, if you are calling the COPY_HISTORY function, this change affects cases in which you pass a bind variable directly as the START_TIME argument:
COPY_HISTORY( START_TIME=> ?, ...
This does not affect cases in which you pass the bind variable to another built-in function first:
COPY_HISTORY( START_TIME=> DATEADD('days', ?, ...
If you want to preserve the behavior before the change, you can rewrite your code to avoid passing the argument that uses the bind variable. For example, if you are calling the TASK_HISTORY function and you do not want the results filtered by a specific task, omit the TASK_NAME argument from the call.
The following table function arguments are affected by this change:
Table Function |
Arguments Affected |
---|---|
OBJECT_TYPE |
|
OBJECT_NAME |
|
TABLE_NAME |
|
START_TIME |
|
ROOT_TASK_NAME |
|
RESULT_LIMIT |
|
TABLE_NAME |
|
LOCATION |
|
FILE_FORMAT |
|
FILES |
|
POLICY_NAME |
|
REF_ENTITY_NAME |
|
REF_ENTITY_DOMAIN |
|
END_TIME_RANGE_START |
|
END_TIME_RANGE_END |
|
RESULT_LIMIT |
|
SESSION_ID |
|
RESULT_LIMIT |
|
USER_NAME |
|
WAREHOUSE_NAME |
|
END_TIME_RANGE_START |
|
END_TIME_RANGE_END |
|
RESULT_LIMIT |
|
OBJECT_NAME (the |
|
TASK_NAME |
|
RESULT_LIMIT |
|
TASK_NAME |
|
DATE_RANGE_START |
|
DATE_RANGE_END |
|
WAREHOUSE_NAME |
|
DATE_RANGE_START |
|
DATE_RANGE_END |
Ref: 1410