Re: hiding column values for specific rows

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: hiding column values for specific rows
Date: 2006-11-13 13:22:05
Message-ID: 20061113132205.GB14281@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message T E Schmitz 2006-11-13 13:46:00 max (timestamp,timestamp)
Previous Message Luca Ferrari 2006-11-13 13:11:50 hiding column values for specific rows