Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2011
    Posts
    5

    Unanswered: Foreign Key Another schema / user

    to all member

    i am sorry, i very newbie
    but i want learn

    and so sorry , my english is so difficult to undertand


    i have problem in my project

    1. can we using foreign key use another schema / user

    ex:

    table A = user A
    table B = user B

    table A -> foreign key table B (can that )??

  2. #2
    Join Date
    Apr 2011
    Posts
    3
    sorry,.btw,why you want to use another foreign key to another schema/user?

  3. #3
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Yes that's possible, but user user A needs to have the approriate privileges for table_b

    Assuming that user_a also wants to see the data in table_b, user_b needs to grant the following privileges:
    Code:
    GRANT SELECT, REFERENCES on table_b TO user_a;
    (This needs to be run when connected as user_b)

    The select privilege allows user_a to see the data in table_b
    The references privilege allows user_a to create a foreign key constraint to table_b

  4. #4
    Join Date
    Apr 2011
    Posts
    5
    Quote Originally Posted by shammat View Post
    Yes that's possible, but user user A needs to have the approriate privileges for table_b

    Assuming that user_a also wants to see the data in table_b, user_b needs to grant the following privileges:
    Code:
    GRANT SELECT, REFERENCES on table_b TO user_a;
    (This needs to be run when connected as user_b)

    The select privilege allows user_a to see the data in table_b
    The references privilege allows user_a to create a foreign key constraint to table_b
    Very Super That's Answer

    it's work

    thx. . . regards

  5. #5
    Join Date
    Apr 2011
    Posts
    3
    when we use such a case??

  6. #6
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by VergilL View Post
    when we use such a case??
    When you have one central user that holds e.g. lookup information (currencies, countries, language codes, ...) and want to use that from several applications each of them having their own database schema (user).

  7. #7
    Join Date
    Apr 2011
    Posts
    3
    Quote Originally Posted by shammat View Post
    When you have one central user that holds e.g. lookup information (currencies, countries, language codes, ...) and want to use that from several applications each of them having their own database schema (user).
    oh I understand now. thanks for the enlightenment,.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •