2

I have a project in heroku. I have the URI that enables me to connect with the database in my external rails app. How do I change or set the search path in ruby code?

Dan Dunclace
  • 23
  • 1
  • 3

2 Answers2

1

You can define it in your database.yml using the schema_search_path key with a string value

production:
  adapter: postgresql
  ...
  schema_search_path: 'schema1,public'

You can find out a bit more here: https://til.hashrocket.com/posts/5aa2892b43-set-schema-search-path

0

For the session, when inside/connected with psql, you can use SETsearch_path =. Or you can use the GUC and change the default for the user or database which will impact all connections from the user or to the specified database.

  • ALTER ROLE myUsername SET search_path = ...
  • ALTER DATABASE myDatabase SET search_path = ...
Evan Carroll
  • 65,432
  • 50
  • 254
  • 507