on 2012 May 25 5:51 AM
I have migrated an old database to SA 12. The database contains tables with the same names but different owners. Because of that I get the error 'Table name xx is ambiguuous'.
Is it possible to change permissions of users in the Sybase Central so that the user can access only the table whose owner it is and the above error does not occur?
I tried to create two groups in Sybase Central and restricted the tables from the 'Table Permissions', but it does not seem to help. Am I doing something wrong?
Edit: After reading Volker Barth's answer I wanted to explain bit more about the problem:
Yes, the problem is causing because the owner of the table is not specified in the application. Please consider following structure:
Tables:
table1 owner user1 table1 owner user2 table2 owner user1
As you can see there are some tables with unique names, and some have the same name but different owner.
Now there are two groups. both of them have membership to the user1 because both need to use tables owned by both users. Here's example of my groups:
Groups: group1 group2 Group Memberships: group1 membership: user1, PUBLIC group2 membership: user1, PUBLIC Users: userA userB User Memberships: userA (group1, PUBLIC) userB (group2, PUBLIC)
Now if I create the users in the group1, it will NOT have any problem, and it will always use the table1 owned by the user1. However, I need to create a user in group2, so that it can use table 1 owned by the user2 as well as table2 owned by user1.
So, Is it possible to give permission to the group2 of the tables owned by user2 and ONLY those tables of user1 which do not have same name as tables owned by user1? I hope my question makes some sense.
I'll highly appriciate any help regarding this problem.
Request clarification before answering.
I still can't give good advice without knowing more details. Just two more suggestions:
That would help to build unambiguous table name sets for all groups, and accessing tables without spcifying the owner name should work.
Some hints can be found here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I maneged to make it work using your first suggestion. I devided tables into 3 owners. 1 owner for common, and some tables for group1 and others for group2. Some of the datawindows were using the procedures, so I had to change their ownership (and copy for same procedure for group1 and group2), bit complicated but at the end i made it work. Thank you for the great help.
I assume the error message results from accessing the table without specifying the owner name, as the combination of owner and object name MUST be non-ambiguous.
There are the different concepts of visibility/name scope vs. permissions (note: there may be better terms for these notions) that do matter here:
Visibility ("scope"): You can "see" any database object without specifying the owner name (i.e. without a "qualified" name like "GROUPO.Products") if you are the owner of the object or are member of a group that owns the object. For that reason, ambiguities may result if a user U belongs to two different groups and each group owns an object with the same name, say, "GROUPO.Products" and "GROUPR.Products". Now, if U tries to access "select * from Products" this will fail. - There's nothing you can do about that except modifying the group membership or using a qualified name, i.e. adding the owner name.
Permission: The above is totally independent of the question whether a user is allowed to access the database object in the desired way (SELECT, INSERT, EXECUTE, whatever). This is managed by database permissions, in particular by GRANT and REVOKE. And there are particular permissions, such as the owner's imoplicit permission to do anything with its objects.
The docs handle this well IMHO, see Managing user IDs, authorities, and permissions and in particular Database object names and prefixes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to add: The according problem description for error message -852 is as helpful as possible:
A statement has referred to a table name that is not unique. Preface the table name by an owner name.
@Volker Barth Thanks for the detailed answer. I added some details in my question, please have a look.
User | Count |
---|---|
68 | |
16 | |
12 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.