Re: Isolation of multiple databse instances provided by a single postgres server

"Peter J. Holzer" <[email protected]>
Newsgroups gmane.comp.db.postgresql.general
Message-ID <[email protected]>
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.
|_|_) |                    |
| |   | [email protected]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl3XDewACgkQ8g5IURL+
KF1YoQ/+NEyeZ7DdmAtpDOSpMhorp8CaU+dSUjGFaxxiNutnXtEhQzqpjA39kxep
J3MHqQEzbTuxro4hgIpBY2QLqwhMHo0LgGzp4wlis61poSo0k8SXQW6jqzf0QNCC
8Jg8wIUru56CUcKIlaPwhg6UqC+CbyfluOBfRX3WajwSkeupCyru+SXyQ0KDfQN3
TgGa96xeQAWbZefsBQV686IoLjsMjCFEKupkYPeUdX8Mia8YOVOvIA4BuQMRI3cF
taI1b1iEZxV2okUKmpKuZc/LYT/rhrUCSSIgL3ySN+FInBgNLSOeP42rpFeD2KHf
S2x4usRKEHFaS3H6K4gOH2Gtg5tSOPmdm/gpt8geMlV5JJF5b4l4CEfXw8S7QArt
VvsFTWKIYN65ZJd+g10GO/vjokwXCLsUzd0mnR5CM8c88MRZytaC/+wslAImxOu4
shi5R0dA46nUStAHF4X/NmpHNsr0aMw4qSMBkwJ8jQKh27acuI7Qc3VjDzggpk2g
mcN4JBzUJ84WBIw0Wi1AhWbxfIpifynv1e0443FDpoX1iXVm0HmEI/jK2PaLMWYl
1220xsaTQu4CGBWmFAj6fNPhPZGLqEjNSO6l7jsik5c+/Ab2lU1jAsRUIrFjVEL+
btF+E5npUlLKE0BzaaKjtdD0+T5WAq1TunZqKWmlHJJCMNa0lBc=
=Gpou
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.