Search code examples
node.jspostgresqlherokuparse-serverheroku-postgres

How to specify a schema name in the Postgres URL for connecting to a PostgreSQL database on Heroku


I am connecting my parse-server application to a PostgreSQL database hosted on the Heroku-PostgreSQL service.

My database is with a schema called gc which is different to the default public schema on Postgresql.

I used the following to connect to the database from my parse-server application.

"postgres://{USERNAME}:{PASSWORD}@{HOSTNAME_ON_AWS}:5432/{DATABASE_NAME}?ssl=true" 

But the issue was it was connected to the public schema but not the gc schema I wanted.

Is there a way to specify the schema name in Postgres URL?


Solution

  • I don't think you can,

    what you can do however is associate a schema search path with a database user, so if you want a different schema you'd can to use a different username to connect as.

    SQL:

    alter user fred set search_path to 'gc';