Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76

    Unanswered: Finding dependant tables

    If I have 2 tables Employee -> User. Employee has a a foreign key called user_id that references user_id in User.

    What query could I use using the system catalogs to determine any table that would depend on User?

    So that if I passed User, I would get Employee.

  2. #2
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76
    I found it:
    To get the amount of dependancies for a table called 'user':

    select count(*) from pg_trigger where tgtype = 21 and tgconstrrelid in (select oid from pg_class where relname = 'user');

Posting Permissions

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