Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oracle] database in @Entity works in select, but not in create #6661

Closed
liudonghua123 opened this issue Sep 3, 2020 · 2 comments
Closed

Comments

@liudonghua123
Copy link

Issue type:

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

Database system/driver:

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

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

I try to use typeorm for my oracle database, and I need to use another user's table USR_YX.T_YX_PC, and I do have releated privileges, the current database connection user is USR_YX_STATISTICS. So I write a demo entity like this.

import {Entity, PrimaryColumn, PrimaryGeneratedColumn, Column, BaseEntity} from "typeorm";

@Entity({name:'T_YX_PC',database:'USR_YX'})
export class PC extends BaseEntity {
//...
}

And then it will create USR_YX_STATISTICS.T_YX_PC table, but select USR_YX.T_YX_PC table.

@wfpena
Copy link
Contributor

wfpena commented Sep 3, 2020

I think for oracle it would make more sense to use the schema property inside the @Entity annotation in this case no? Like this:

@Entity({name:'T_YX_PC',schema:'USR_YX'})
export class PC extends BaseEntity {
//...
}

And even so this is related to another issue (that is still open): #5621

There is the pull request #6133 that fixes pretty much the same issue you have. Although this pull request actually solves using the schema property

@pirouet
Copy link
Contributor

pirouet commented Sep 8, 2020

Hi, #6133 had some issues so I re-raised with #6673 that is now merged to master branch (no release for it yet). I think the oracle driver assumed that the tables would all be within the user's own schema therefore the schema is not necessarily needed then, however - and in my opinion best practice, would be to always specify it.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants