Sample Header Ad - 728x90

Use or include external schema in search_path on Redshift

3 votes
0 answers
1020 views
# Narrative I have a sql script that creates a bunch of tables in a temporary schema name in Redshift. I don't want to repeat the schema name a bunch of times, so I would like to do something like the following at the top of the script: use long_external_schema_name; My understanding is that in Redshift (inheriting from Postgres), you would do: set search_path to '$user', public, long_external_schema_name; However, I get the following error: ERROR: External schema "long_external_schema_name" cannot be set in search_path Because, it is an **external schema**. # Question Is there any equivalent way that I could stay DRY and write the external schema name only once while I create a bunch of tables in it? # More Context Note, I know I have lots of options in bash (arguments, sed, vim, etc) to replace the schema name in the script, but I'm trying to do something more native to Redshift / psql.
Asked by combinatorist (233 rep)
Aug 20, 2019, 08:03 PM
Last activity: Jun 5, 2025, 06:34 PM