Received: from wallace.ece.rice.edu (root@wallace.ece.rice.edu [128.42.12.154]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA49491 for ; Thu, 2 Dec 1999 10:45:22 -0500 (EST) (envelope-from reedstrm@wallace.ece.rice.edu) Received: by wallace.ece.rice.edu via sendmail from stdin id (Debian Smail3.2.0.102) for pgsql-interfaces@postgresql.org; Thu, 2 Dec 1999 09:45:21 -0600 (CST) Date: Thu, 2 Dec 1999 09:45:21 -0600 From: "Ross J. Reedstrom" To: pgsql-interfaces@postgresql.org Subject: Re: [INTERFACES] Data Migration Message-ID: <19991202094521.A11044@wallace.ece.rice.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: ; from D'Arcy J.M. Cain on Wed, Dec 01, 1999 at 04:23:29PM -0500 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 [AS ] [HOST host] [PORT port] [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., NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005