Is it possible to do something like the following in PostgreSQL???
CREATE DATABASE pub;
CREATE TABLE states (
INSERT INTO states VALUES('AL', 'Alabama');
INSERT INTO states VALUES('OH', 'Ohio');
INSERT INTO states VALUES('WY', 'Wyoming');
CREATE DATABASE accounts;
CREATE TABLE address (
INSERT INTO address VALUES ('1',...,'Akron','OH',...);
INSERT INTO address VALUES ('2',...,'Canton','OH',...);
-- Connect to accounts database
USE accounts; -- From MySQL
SELECT a.adr_id AS id, a.adr_city AS city, s.st_name as state
FROM address a, pub.states s
WHERE a.adr_state = s.st_abv;
This query returns a parse error on the '.' in pub.states. If I move
the states table into the accounts and replace pub.states with
states, the query works properly. However, I would like to keep one
copy of states in the pub database instead of having to create a copy
in every databae that will use it.
While I chose the above as an example, I have other tables which I
would also like to store in a single database while being accessable
from an arbitrary number of other databases.
In MySQL, this can be accomplished with the USE statement which from
the documentation appears to be for Sybase compatibility. Since
there is no USE statement in PostgreSQL, is there another way to
achieve the desired results?
pgsql-sql by date
|Next:||From: Wayne Piekarski||Date: 1999-06-25 06:52:36|
|Subject: Re: trouble creating log table with rules|
|Previous:||From: J Kinsley||Date: 1999-06-24 23:32:48|
|Subject: Is SELECT FROM multiple databases possible??? (USE db?)|