pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Isolation of multiple databse instances provided by a single postgres server
Date: Thu, 21 Nov 2019 23:21:32 +0100
Message-ID: <20191121222132.GD17288@hjp.at> (raw)
In-Reply-To: <5c065b95-9f53-116c-1f23-2800eeeca744@aklaver.com>
References: <20191120220353.GA24554@panix.com>
	<db8bd3e1-7217-a66d-6113-2f402d89801c@gmail.com>
	<20191121115549.GA3417@panix.com>
	<a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at>
	<5c065b95-9f53-116c-1f23-2800eeeca744@aklaver.com>

On 2019-11-21 07:21:10 -0800, Adrian Klaver wrote:
> On 11/21/19 6:51 AM, Laurenz Albe wrote:
> > - The different databases in a cluster are physically located in
> >    the same tablespace, but they are logically strictly separated.
> >    You cannot connect to one database and access another database from there.
> 
> dblink(https://www.postgresql.org/docs/11/dblink.html) and
> FDW(https://www.postgresql.org/docs/11/sql-createforeigntable.html) would
> beg to differ.

I was thinking of FDW.

But I think Laurenz had the SQL syntax in mind which does include the
database in the fully qualified form of a tablename. Something like

db2=# select * from db2.public.t3;
╔════╤═══════════════════════╗
║ id │           t           ║
╟────┼───────────────────────╢
║  1 │ this is db2.public.t3 ║
╚════╧═══════════════════════╝
(1 row)

works. But when you try to access a table in a different database you
get an error:

db2=# select * from db1.public.t1;
ERROR:  cross-database references are not implemented: "db1.public.t1"
LINE 1: select * from db1.public.t1;

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (11+ messages)

Message-ID: <20191121222132.GD17288@hjp.at>
Permalink:  ../20191121222132.GD17288@hjp.at/
Also on:    postgresql.org/message-id/20191121222132.GD17288@hjp.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: Isolation of multiple databse instances provided by a single postgres server
  In-Reply-To: <20191121222132.GD17288@hjp.at>
  References: <20191120220353.GA24554@panix.com> <db8bd3e1-7217-a66d-6113-2f402d89801c@gmail.com> <20191121115549.GA3417@panix.com> <a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at> <5c065b95-9f53-116c-1f23-2800eeeca744@aklaver.com> <20191121222132.GD17288@hjp.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox