On Wed, Dec 01, 1999 at 04:23:29PM -0500, D'Arcy J.M. Cain wrote:
> Thus spake Roderick A. Anderson
> > On Wed, 1 Dec 1999, Tom Lane wrote:
> > > No; in Postgres, different databases are different universes ... and
> > > there are no wormholes in SQL ;-).
> >
> > Does SQL92 say no wormholes? Is it a major pain to code this? I've got
> > no complaints as I can see ways to do it from the application level.
>
> I don't know what SQL92 says and. like you, I have easy ways to do this
> at the app level but for what it's worth, here's a suggested syntax
> for this in case someone want to implement it.
>
> OPEN DATABASE <dbname> [AS <alias>] [HOST host] [PORT port] [TYPE <db type>]
This syntax seems reasonable, although as Oleg pointed out, you need
various amounts of authentication info. I suppose an inital restriction
(and latter default) for connecting to dbs under the same postmaster, is to
use the same user, since you've already authenticated. Going to a differnent
type of db would require some alternative authentication, however. There
may be db type specific attributes as well.
>
> And use it as
>
> OPEN DATABASE db1 HOST 'other.what.com';
> SELECT * FROM mytab, db1.othertab yourtab
> WHERE mytab.f1 = yourtab.f1;
>
> or
>
> SELECT mytab.f1, db1.yourtab.f2, ...
>
This notation, db.table.field, does seem to be how other DBMSs do
it. I've been wondering, however, if our parser would have any trouble
with it, since in an identifier string token1.token2, token1 is no longer
guaranteed to be a table. Need to look at the code, I suppose.
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
************