Bind variables: No longer ignored as parameters for some built-in table functions (Pending)

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=> ?, ...
Copy

This does not affect cases in which you pass the bind variable to another built-in function first:

COPY_HISTORY( START_TIME=> DATEADD('days', ?, ...
Copy

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

AUTO_REFRESH_REGISTRATION_HISTORY

OBJECT_TYPE

OBJECT_NAME

COPY_HISTORY

TABLE_NAME

START_TIME

CURRENT_TASK_GRAPHS

ROOT_TASK_NAME

DYNAMIC_TABLE_REFRESH_HISTORY

RESULT_LIMIT

EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY

TABLE_NAME

INFER_SCHEMA

LOCATION

FILE_FORMAT

FILES

POLICY_REFERENCES

POLICY_NAME

REF_ENTITY_NAME

REF_ENTITY_DOMAIN

QUERY_HISTORY

END_TIME_RANGE_START

END_TIME_RANGE_END

RESULT_LIMIT

QUERY_HISTORY_BY_SESSION

SESSION_ID

RESULT_LIMIT

QUERY_HISTORY_BY_USER

USER_NAME

QUERY_HISTORY_BY_WAREHOUSE

WAREHOUSE_NAME

END_TIME_RANGE_START

END_TIME_RANGE_END

RESULT_LIMIT

TAG_REFERENCES

OBJECT_NAME (the object_name argument)

TASK_DEPENDENTS

TASK_NAME

TASK_HISTORY

RESULT_LIMIT

TASK_NAME

WAREHOUSE_LOAD_HISTORY

DATE_RANGE_START

DATE_RANGE_END

WAREHOUSE_NAME

WAREHOUSE_METERING_HISTORY

DATE_RANGE_START

DATE_RANGE_END

Ref: 1410