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

EntityMetadata ignores Schemas for OracleDriver #4820

Closed
jf214 opened this issue Sep 26, 2019 · 8 comments
Closed

EntityMetadata ignores Schemas for OracleDriver #4820

jf214 opened this issue Sep 26, 2019 · 8 comments

Comments

@jf214
Copy link

jf214 commented Sep 26, 2019

Issue type:

[ ] question
[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'm using the OracleDriver and after upgrading to the 0.2.19, the generated queries ignore the schemas defined on my Entity Definition.

Example Entity

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

@Entity({
  name: "PERSON",
  schema: "DW_ADMIN"
})
export class Person {
    @PrimaryColumn({ name: "ID" })
    public id: number;

    @Column({ name: "NAME" })
    public name: string;
}

The resulting query:

SELECT "p"."ID" AS "p_ID", "p"."NAME" AS "p_NAME" FROM "PERSON"

The result is an oracle error because there is no schema attached to the table in the query
ORA-00942: table or view does not exist

Prior to upgrading the query was:

SELECT "p"."ID" AS "p_ID", "p"."NAME" AS "p_NAME" FROM "DW_ADMIN"."PERSON"
@marrasen
Copy link

marrasen commented Oct 7, 2019

We have a similar problem using MySQL. I think this is a problem for all databases except Postgres and SqlServer since this commit d8f1c81

@kdi-1
Copy link

kdi-1 commented Oct 26, 2019

The same problem. Any workaround?

@marrasen
Copy link

The same problem. Any workaround?

We reverted to version 0.2.18 until this is resolved

@jf214
Copy link
Author

jf214 commented Oct 26, 2019

We've done the same.

@marrasen
Copy link

@jf214 Just discovered that if you change your entities from saying schema to database you can avoid this bug

@Entity("table_name", {database: "schemaname"})

@jf214
Copy link
Author

jf214 commented Feb 12, 2020

Nice workaround. I'll try it out.

@jadilson12
Copy link

@marrasen

thanks, it worked

@imnotjames
Copy link
Contributor

This was fixed with #6673

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

5 participants