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

PostgreSQL

SET SEARCH_PATH TO schema1;

Snowflake

USE DATABASE schema1;

Case 2

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*/;
  1. MSC-PG0005: Set search path with multiple schemas.

Last updated

Was this helpful?