Unix Technical Forum

private table

This is a discussion on private table within the pgsql Sql forums, part of the PostgreSQL category; --> Hello, I am want to use a private table in postgresql(every client to see his own data). Is this ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 11:53 AM
Din Adrian
 
Posts: n/a
Default private table

Hello,
I am want to use a private table in postgresql(every client to see his own
data).
Is this possible? How can I do it!

Thank you,
Adrian Din

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 11:53 AM
Andreas Kretschmer
 
Posts: n/a
Default Re: [despammed] private table

am 26.01.2005, um 10:13:52 +0200 mailte Din Adrian folgendes:
> Hello,
> I am want to use a private table in postgresql(every client to see his own
> data).
> Is this possible? How can I do it!


Why?

You can create different users and/or different databases.


Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47212, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
eMail schreiben kann jeder -- lernen: http://webserv/email/email.html

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 11:53 AM
Richard Huxton
 
Posts: n/a
Default Re: private table

Din Adrian wrote:
> Hello,
> I am want to use a private table in postgresql(every client to see his
> own data).
> Is this possible? How can I do it!


If I understand what you want, then this is traditionally done using views.

CREATE TABLE base_table (
a integer NOT NULL,
b text,
u name,
PRIMARY KEY (a)
);

CREATE VIEW my_rows AS
SELECT a,b FROM base_table WHERE u = CURRENT_USER;

Add rules so that updating my_rows updates base_table instead. Then,
revoke access on base_table (apart from your super-user) but grant it on
my_rows.

As far as a user is concerned "my_rows" just contains their rows and if
they log in as a different user they will see different data.
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:54 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com