Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Oracle "FROM all_tables WHERE owner = (select user from dual)" query #112

Open
Ginden opened this issue Oct 26, 2018 · 4 comments
Open

Oracle "FROM all_tables WHERE owner = (select user from dual)" query #112

Ginden opened this issue Oct 26, 2018 · 4 comments
Labels
bug no known workaround

Comments

@Ginden
Copy link

Ginden commented Oct 26, 2018

Problem:

typeorm-model-generator run following query:

 SELECT 
   NULL AS TABLE_SCHEMA,
   TABLE_NAME
FROM all_tables 
WHERE  owner = (select user from dual)

This returns 0 results for me, because these tables owner's is not equal to current user - these tables are owned by DBA and I'm working with read-only user.

Solution: add option to specify owner(s).

Workaround: hardcode correct value in node_modules/typeorm-model-generator/dist/src/drivers/OracleDriver.js (replace (select user from dual) with 'YOUR_OWNER').

@Ginden
Copy link
Author

Ginden commented Oct 26, 2018

from user_constraints should be replaced with from all_contraints owner (...) WHERE owner.owner = 'YOUR_OWNER' .

Changes are required throughrough whole file.

@Kononnable Kononnable added the bug no known workaround label Oct 27, 2018
@goughjo02
Copy link

@Ginden can you please clarify. I am trying to get this package working for an oracle database.

user_constraints is also used in many joins, should we change user_constraints to all_constraints owner (...) where owner.owner = 'YOUR_NAME' in every join also?

Also what should replace the ellipsis inside the parenthesis?

TIA

@goughjo02
Copy link

ok I got it working. I had to change four SQL strings in OracleDriver.js. They start at lines 25, 40, 174, and 205.

@liudonghua123
Copy link

@goughjo02 Hi, could you provided which files you changed, maybe a pr or diff links will helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug no known workaround
Projects
None yet
Development

No branches or pull requests

4 participants