Privs
A reader, October 19, 2016 - 10:58 am UTC
..and what if user app needs to select delete insert truncate ...The tables of SCHEMA_OWNER??
Do app user have rights on SCHEMA_OWNER' objects?
October 19, 2016 - 12:44 pm UTC
You need to grant the privileges from schema_owner to app_user. This applies whether you're using set current_schema or synonyms.
Chuck Jolley, October 19, 2016 - 2:59 pm UTC
Why not just use fully qualified object names in the application?
One way or another the grants have to be made to the app_user anyway.
More generally, what is set current_schema used for?
October 19, 2016 - 3:27 pm UTC
Fully qualifying is a better solution.
More generally, what is set current_schema used for?
So you don't need to fully qualify the schema! Besides laziness, it's potentially useful if you have an app which you'd like to regularly switch between schemas that have the same tables. Or want to maintain schema independence for some reason.
Chuck Jolley, October 19, 2016 - 4:49 pm UTC
"So you don't need to fully qualify the schema!"
For some reason this reminds me of the question "How can I get a sorted result without using an order by clause?"
October 20, 2016 - 1:19 am UTC
There is in fact a (very small) overhead to resolving things via synonyms - public is worse than private and private is worse than none.
So if you're looking to squeeze every ounce of scalability out of your server/apps, then its possibly worth a mention. I prefer 'alter session set current_schema' not just for that reason - it just means less clutter, ie, less stuff to manage.