Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 98F23632793 for ; Fri, 5 Mar 2010 18:14:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 19874-07 for ; Fri, 5 Mar 2010 22:13:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web39701.mail.mud.yahoo.com (web39701.mail.mud.yahoo.com [209.191.106.47]) by mail.postgresql.org (Postfix) with SMTP id F162D632417 for ; Fri, 5 Mar 2010 18:13:52 -0400 (AST) Received: (qmail 83513 invoked by uid 60001); 5 Mar 2010 22:13:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1267827231; bh=gaE+M3Pbl4daKFNJCvDYnl1cSejQglYbH+SCAYioBkI=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=JeHGCwfY7dDw4tfN4liBlN8b3jLpR7oeCh6pOv1IDCRS6xI7gGhauDHNWyMQ87C1lV9HocqSI7T8r72ZsP7/ixsfYxxYNi8yYb90gpfRmkHsq3E8b6+0XRjIQRZkVBFUwdeXVmREai73IxmbshHow3Q8U35lvtzagwrij+sgZvI= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=0oXfXHc1F33z3b41QG/kvtbYv1W3dCRq1YFezwAz+d6nQ24OhkSJLbDQIyE+oFcEXQQOa+8nXfBw13eB97OVDHiqPMR1lgK55MNLsKciXwuNHMkFiTpVT01Hm6wM5oxa6SZXDSM2Bk0ZjIkXKe7RmnNzAmT/PXpDRtolQPPzZTw=; Message-ID: <576643.83333.qm@web39701.mail.mud.yahoo.com> X-YMail-OSG: RYlj.RkVM1ly1hk1a0IYTeWimtt51k.7h3TOmf4mHlmp0tO qy6Nq.SE.S2WyUYc2OceR89TAzQ7QEE1DVq9vUDey_m5tXSzQdt1z7ZD.cmk v8yUmc8fDjmYrMfjsVFjqbuzyV.lvlaEUZCzXjJvfBBOU5REzpKy92G0zKY_ ourvxr8KhO.IK.Djy8Iwk1KbMh0uvPRGuLvmBHk8Sojw9IBhMsLvBYlFmX1Q djeTTLe9F296BACvJ.jGPjLV3elQOs3nLZRJWb_1lTSUIU4Hs8E1l4iRGmle iYXKmjY5yOWe.Pv9iOeqUzoNLfRBgYoNj9OtRSK7f4BthwWbkZnaH64TRUuk uDX7BCmaAKvifnKuv_Ev2i.P8Z32n9oxE3A-- Received: from [64.126.29.122] by web39701.mail.mud.yahoo.com via HTTP; Fri, 05 Mar 2010 14:13:51 PST X-Mailer: YahooMailClassic/9.2.12 YahooMailWebService/0.8.100.260964 Date: Fri, 5 Mar 2010 14:13:51 -0800 (PST) From: Bob Lunney Subject: Re: Querying the same column and table across schemas To: pgsql-admin@postgresql.org In-Reply-To: <1267818283.15754.42.camel@Family.pacifera.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/47 X-Sequence-Number: 33846 =0A=0A--- On Fri, 3/5/10, John A. Sullivan III wrote:=0A=0A> From: John A. Sullivan III =0A> Subject: [ADMIN] Querying the same column and table across schemas=0A= > To: pgsql-admin@postgresql.org=0A> Date: Friday, March 5, 2010, 2:44 PM= =0A> Hello, all.=A0 I'm working on a=0A> project using the X2Go terminal se= rver=0A> project (www.x2go.org).=A0 They record session data in a=0A> postg= resql=0A> database.=A0 Our environment is a little more secure=0A> than typ= ical and we=0A> do not want it possible for one user to see another's=0A> s= ession data.=A0 We=0A> thus have divided the session database into schemas = each=0A> with an=0A> identical set of tables.=A0 Each user only writes and= =0A> reads from their=0A> schema.=0A> =0A> However, we need to query all sc= hemas as if they were=0A> one.=A0 Is there a=0A> way to do that?=0A> =0A> I= n other words, if we were a single schema database, we=0A> could do=0A> =0A= > select session_id from sessions;=0A> =0A> to list all sessions.=A0 How ca= n we accomplish the same=0A> thing to list all=0A> the sessions across all = the schemas in a single query?=0A> =0A> I'm trying to avoid making a thousa= nd call like=0A> =0A> select user1.session_id from user1.sessions;=0A> =0A>= when I could do it in a single query especially since the=0A> database is= =0A> remote and secured with SSL.=0A> =0A> Thanks - John=0A> =0A=0AJohn,=0A= =0AHow about creating a central admin schema and putting a trigger on all t= he sessions tables to write changes to the central admin schema's session t= able? The function could belong to the admin role and run with definer's s= ecurity.=0A=0ABob=0A=0A=0A