Thread: AGAIN: Linking data across databases

AGAIN: Linking data across databases

From
Gonzalo Garramuno
Date:
I sent this yesterday & I was told I got a response, but I have been
unable to see it in the website, since I was not yet subscribed to the
list.

I'm now subscribed to the list (I hope at least), although I have not
gotten any messages yet.

Could some kind soul please answer again or send it to me again?  Thanks
a million.

=-=-

A newbie working with databases, although good with all sorts of
programming.  Bear with me for the stupid questions.

1) How do you link tables across databases?  I have these databases that
need similar data but must remain separate databases (since data is used
in several places -projects, etc. )

For example:
        I have a database called:       people_db   - list of all the
people at my company.
        I have an employee database:    employee_db - which also needs
references to people.
        I have a project database:      proj_db     - which needs a
table reference to the
                                                      people.

Basically, in SQL something like:
        > \c people_db
                CREATE TABLE person_tb (
                        person_id       int2 PRIMARY KEY,
                        person_name     varchar(30),
                        person_????    ...other_crap...
                );

        > \c employee_db
                CREATE TABLE employee_tb (
                        employee_id             int2 PRIMARY KEY,
                        employee_salary         int4,
                        employee        ...other crap...
                ) INHERITS (people_db::person_tb);              <=== how
can I inherit it?
                                        <=== also, what's a good naming
convention?
                                                I've used "table_xxx"
for columns, since that
                                                clarifies when doing
joins and checks later,
                                                but with inheritance, I
end up with
                                                employee_tb having
person_name, instead of
                                                employee_name.

        > \c proj_db
                CREATE TABLE project_tb (
                        proj_id         int2 PRIMARY KEY,
                        proj_name       varchar(30),
                        assigned_to     int2 REFERENCES employee_db(
employee_id )
                        ...other crap...
                );

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gonzalo Garramuno
gga@mooncrescent.com            Moon Crescent Studios
Phone: 310.727.2800            1600 Rosecrans Ave
Fax:   310.727.2801            Manhattan Beach, CA. 90266.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Re: AGAIN: Linking data across databases

From
Web Manager
Date:
Gonzalo Garramuno wrote:
>
> I sent this yesterday & I was told I got a response, but I have been
> unable to see it in the website, since I was not yet subscribed to the
> list.
>
> I'm now subscribed to the list (I hope at least), although I have not
> gotten any messages yet.
>
> Could some kind soul please answer again or send it to me again?  Thanks
> a million.
>
> =-=-

Hello,

I asked the same question and the answer is "Not possible" and "not
available with Postgres"... I needed to join few tables from 2 separate
db... I hope this will become reality in 7.1  8-)

Salutation!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marc Andre Paquin