2

I'm moving an application from RoR to Express.js. ActiveRecord postgres adapter has the search_path configuration option.

Is it possible to set the search_path for the Client ?

2

3 Answers 3

2

My preference would be to chance this on the database or user if possible.

ALTER [DATABASE or USER] [name] set search_path='[searchpath]'

If that fails you can always make sure your search path is set by building into your connection logic:

SET search_path='[searchpath]'

That will set it on the connection.

Sign up to request clarification or add additional context in comments.

Comments

2

Yes sure you can automaticaly triger SET command "on" connection event

pool.on('connect', (client) => {
  client.query('SET search_path TO schema,public');
});

Comments

0
process.env.PGOPTIONS="-c search_path=some_schema"

1 Comment

Your answer could be improved by adding more information on what the code does and how it helps the OP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.