Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 79C1863390D for ; Fri, 5 Mar 2010 15:50:01 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 85041-09 for ; Fri, 5 Mar 2010 19:49:46 +0000 (UTC) X-Greylist: delayed 00:05:01.22372 by SQLgrey-1.7.6 Received: from mout.perfora.net (mout.perfora.net [74.208.4.195]) by mail.postgresql.org (Postfix) with ESMTP id 862156329BD for ; Fri, 5 Mar 2010 15:49:49 -0400 (AST) Received: from [192.168.223.100] (cpe-74-75-231-235.maine.res.rr.com [74.75.231.235]) by mrelay.perfora.net (node=mrus3) with ESMTP (Nemesis) id 0MYwiB-1O9r1q0vy7-00Vj6O; Fri, 05 Mar 2010 14:44:46 -0500 Subject: Querying the same column and table across schemas From: "John A. Sullivan III" To: pgsql-admin@postgresql.org Content-Type: text/plain Date: Fri, 05 Mar 2010 14:44:43 -0500 Message-Id: <1267818283.15754.42.camel@Family.pacifera.com> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+OnjUa/rAMBBv3cdDc580rVz1LOdZ372XgYk8 ptuXuvdo0Vj+8XUyNDajFUy6KL3yIggHSr+mS2tEn+BoBXsX74 vPo/jS7+o757rlSGQ8bzDmJLaEeT5OE6tHr68TGBWg= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201003/44 X-Sequence-Number: 33843 Hello, all. I'm working on a project using the X2Go terminal server project (www.x2go.org). They record session data in a postgresql database. Our environment is a little more secure than typical and we do not want it possible for one user to see another's session data. We thus have divided the session database into schemas each with an identical set of tables. Each user only writes and reads from their schema. However, we need to query all schemas as if they were one. Is there a way to do that? In other words, if we were a single schema database, we could do select session_id from sessions; to list all sessions. How can we accomplish the same thing to list all the sessions across all the schemas in a single query? I'm trying to avoid making a thousand call like select user1.session_id from user1.sessions; when I could do it in a single query especially since the database is remote and secured with SSL. Thanks - John