COF-C02 · Question #480
A Snowflake user is writing a User-Defined Function (UDF) that includes some unqualified object names. How will those object names be resolved during execution?
The correct answer is D. Snowflake will first check the current schema, and them the PUBLIC schema of the current. Object Name Resolution: When unqualified object names (e.g., table name without schema) are used in a UDF, Snowflake follows a specific hierarchy to resolve them. Here's the order: Current Schema: Snowflake first checks if an object with the given name exists in the schema…
Question
A Snowflake user is writing a User-Defined Function (UDF) that includes some unqualified object names. How will those object names be resolved during execution?
Options
- ASnowflake will resolve them according to the SEARCH_PATH parameter.
- BSnowflake will only check the schema the UDF belongs to.
- CSnowflake will first check the current schema, and then the schema the previous query used
- DSnowflake will first check the current schema, and them the PUBLIC schema of the current
How the community answered
(43 responses)- A2% (1)
- B7% (3)
- C2% (1)
- D88% (38)
Explanation
Object Name Resolution: When unqualified object names (e.g., table name without schema) are used in a UDF, Snowflake follows a specific hierarchy to resolve them. Here's the order: Current Schema: Snowflake first checks if an object with the given name exists in the schema currently in use for the session. PUBLIC Schema: If the object isn't found in the current schema, Snowflake looks in the PUBLIC schema of the current database. Note: The SEARCH_PATH parameter influences object resolution for queries, not within UDFs.
Topics
Community Discussion
No community discussion yet for this question.