Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8A8049FA154 for ; Mon, 13 Nov 2006 09:22:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 03039-08 for ; Mon, 13 Nov 2006 09:22:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by postgresql.org (Postfix) with ESMTP id 538C59F9C52 for ; Mon, 13 Nov 2006 09:22:11 -0400 (AST) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1GjblG2N3U-0000hc; Mon, 13 Nov 2006 14:22:08 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1GjblF-0006QR-00 for pgsql-sql@postgresql.org; Mon, 13 Nov 2006 14:22:05 +0100 Date: Mon, 13 Nov 2006 14:22:05 +0100 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: hiding column values for specific rows Message-ID: <20061113132205.GB14281@a-kretschmer.de> References: <200611131411.50562.fluca1978@infinito.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200611131411.50562.fluca1978@infinito.it> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/125 X-Sequence-Number: 26777 am Mon, dem 13.11.2006, um 14:11:50 +0100 mailte Luca Ferrari folgendes: > Hi, > I don't know if this's possible but I'd like to hide column values for > specific rows within a query. Imagine I've got a table with columns username > and password: users(username,password). Now I'd like the user registered in > the table to see her password, to see who is registered but not to see the > other people passwords. For example, if the table contains: > username | password > --------------+------------- > luca | myPaswd > roberto | otherPaswd > gianna | thirdPaswd > > I'd like to do a query like: "SELECT * FROM users where username=luca" > obtaining something like: > username | password > --------------+------------- > luca | myPaswd > roberto | xxxxx > gianna | XXXXX > > Is it possible to specify in the above query that all password columns that do You can do this with a VIEW and remoke all from normal users for the original table. Within the VIEW, you can use current_user for the username and/or a case when ... statement for the password-column. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net