X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4602D5280F for ; Wed, 17 Aug 2005 16:06:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90879-05 for ; Wed, 17 Aug 2005 19:06:52 +0000 (GMT) Received: from web51904.mail.yahoo.com (web51904.mail.yahoo.com [206.190.48.67]) by svr1.postgresql.org (Postfix) with SMTP id 7269F52AB6 for ; Wed, 17 Aug 2005 16:06:50 -0300 (ADT) Received: (qmail 93893 invoked by uid 60001); 17 Aug 2005 19:06:50 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=bSGB/0QvejO0AjTkV7QUe7PWNMUALKh55iMNcwxX5QLF3Gs1ys7VK0A8YcJedT+7nWQ6sT3WkvqvuCHJSKlaTmdIQyzJ3jZZEJHIRUAjXCT3NrjjTpyYk0TUggjWh+jlUp4OusxeG4BkKLTKMdCphPZm8JS8NhBRwfrPCKlbXeU= ; Message-ID: <20050817190650.93891.qmail@web51904.mail.yahoo.com> Received: from [80.84.139.168] by web51904.mail.yahoo.com via HTTP; Wed, 17 Aug 2005 12:06:50 PDT Date: Wed, 17 Aug 2005 12:06:50 -0700 (PDT) From: Roger Motorola Subject: Locating ( FKs ) References to a Primary Key To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.374 required=5 tests=[DNS_FROM_RFC_ABUSE=0.374] X-Spam-Level: X-Archive-Number: 200508/128 X-Sequence-Number: 22356 Hi to all, Is there any means by which one can get all Foreign Keys (References) that 'point' to a certain Primary Key for a given table ? For instance, let's consider those three tables: (NOTE: table contents here are not deeply thought of...) // employees table create table emp (id serial primary key, first_name varchar not null, last_name varchar not null, .....................etc.); // employee address create table emp_address (emp_id integer references emp (id), city integer references city (id), primary key (emp_id, city), comments varchar not null); // employee categories () create table emp_categories (emp_id integer references emp (id), institution integer references institutions (id), unique (emp_id, institution), category integer references categories (id), primary key (emp_id, institution, category), description varchar not null); So, can we issue a query that gets all references to emp.id ? which should yield here: emp_address.emp_id and emp_categories.emp_id Thanks in advance, Roger Tannous. ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs