From: | Sherman Willden <operasopranos(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | How to access a second database |
Date: | 2017-10-31 07:15:14 |
Message-ID: | CAGv-wXGfhp=S31kb2KwuLzoSbCKmw3pYutefyWs03i_uNYBbbQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am trying to access a table from another database. I have the permissions
to create under my own login. I have performed the following so far:
sherman(at)sql-dev: createdb sandbox01
sherman(at)sql-dev:~$ createdb sandbox02.
After logging into sandbox02 I performed the following: sandbox02=# CREATE
TABLE last_names(last_name TEXT);
sandbox02=# INSERT INTO last_names VALUES(willden);
Now I think I want to use a foreign key in sandbox01. Is the following how
it works after logging into sandbox01?
sandbox01=# CREATE TABLE first_and_last(first_name TEXT, last_name FOREIGN
KEY last_name REFERENCES sandbox02(last_names(last_name))
and then sandbox01=# INSERT INTO first_and_last(sherman, willden);
Thank you;
Sherman
From | Date | Subject | |
---|---|---|---|
Next Message | Stanislav Ganin | 2017-10-31 07:40:47 | Re: How to access a second database |
Previous Message | Ivan Voras | 2017-10-31 06:50:51 | Re: Roles inherited from a role which is the owner of a database can drop it? |