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 FunctionArguments Affected
AUTO_REFRESH_REGISTRATION_HISTORYOBJECT_TYPE
OBJECT_NAME
COPY_HISTORYTABLE_NAME
START_TIME
CURRENT_TASK_GRAPHSROOT_TASK_NAME
DYNAMIC_TABLE_REFRESH_HISTORYRESULT_LIMIT
EXTERNAL_TABLE_FILE_REGISTRATION_HISTORYTABLE_NAME
INFER_SCHEMALOCATION
FILE_FORMAT
FILES
POLICY_REFERENCESPOLICY_NAME
REF_ENTITY_NAME
REF_ENTITY_DOMAIN
QUERY_HISTORYEND_TIME_RANGE_START
END_TIME_RANGE_END
RESULT_LIMIT
QUERY_HISTORY_BY_SESSIONSESSION_ID
RESULT_LIMIT
QUERY_HISTORY_BY_USERUSER_NAME
QUERY_HISTORY_BY_WAREHOUSEWAREHOUSE_NAME
END_TIME_RANGE_START
END_TIME_RANGE_END
RESULT_LIMIT
TAG_REFERENCESOBJECT_NAME (the object_name argument)
TASK_DEPENDENTSTASK_NAME
TASK_HISTORYRESULT_LIMIT
TASK_NAME
WAREHOUSE_LOAD_HISTORYDATE_RANGE_START
DATE_RANGE_END
WAREHOUSE_NAME
WAREHOUSE_METERING_HISTORYDATE_RANGE_START
DATE_RANGE_END

Ref: 1410