question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`schema` option in postgres driver is not doing anything

See original GitHub issue

[x] bug report [ ] feature request [x] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [x] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[x] latest [ ] @next [x] 0.2.26

The documented schema parameter for postgres does not seem to be doing anything. There was a PR for adding a default schema in the past, though under the schemaName property, but it seems this feature was removed completely.

All that remains is a schema option defined in the postgres driver, which does not have any effect it seems.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
romandeckercommented, Sep 17, 2020

For anyone wondering, for now I’m working around the issue by doing this right after createConnection():

const conn = await createConnection();

const options = conn.driver.options as PostgresConnectionOptions;
if (options.schema && options.schema !== 'public') {
    await getConnection().query(`SET search_path TO '${options.schema}', 'public'`);
}

1reaction
imnotjamescommented, Sep 29, 2020

Should be fixed in #6796 😃 Test was put in place that checks it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting schema in PostgreSQL JDBC doesn't seem to work
I'm using JDBC driver 42.2.2 and PostgreSQL server 10.4. Why setting schema doesn't work? java · postgresql · jdbc · schema.
Read more >
Initializing the Driver - PostgreSQL JDBC Driver
Any source file that uses JDBC needs to import the java.sql package, using: ... Applications do not need to explicitly load the org.postgresql....
Read more >
PostresSql not showing all schemas
Already tried MySQL and MsSQL successfully but I'm having trouble with Postgres - It's not showing all the existing schemas in my server....
Read more >
3. Configuring Schema Build Options - HammerDB
Note that in any circumstance you do not have to rebuild the schema every time you change the “Driver Options”, once the schema...
Read more >
Information schema for PostgreSQL-dialect databases
This view lists all the options defined for the referenced table columns of a ... A stored generated column in this state does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found