SET SEARCH PATH

Description

The Schema Search Path is a list of schema names that PostgreSQL uses to search for objects (such as tables, views, functions, etc.) that are not specified with a schema prefix.

Click here to navigate to the PostgreSQL documentation page for this syntax.

Grammar Syntax

SET search_path TO myschema;

Sample Source Patterns

Case 1

The SET SEARCH_PATH is translated to USE SCHEMA in snowflake.

PostgreSQL

SET SEARCH_PATH TO schema1;

Snowflake

USE DATABASE schema1;

Case 2

The SET SEARCH_PATH is translated to USE DATABASE in snowflake, but only with one element of the SET SEARCH_PATH sequence.

USE SCHEME is used to select the active scheme of the session. You may only have one schema active, so only the first element of the SET SEARCH_PATH sequence is kept, and the other elements are commented out.

PostgreSQL

SET SEARCH_PATH TO schema1, schema2, schema3;

Snowflake

--** MSC-ERROR - MSC-PG0005 - SET SEARCH PATH WITH MULTIPLE SCHEMAS IS NOT SUPPORTED IN SNOWFLAKE **
USE SCHEMA schema1 /*, schema2, schema3*/;

Last updated