Re: acessibility for tables - Mailing list pgsql-general

From Willy-Bas Loos
Subject Re: acessibility for tables
Date
Msg-id CAHnozTi7-k8+c_nXnNoWOY1-LO9oUGgEpLnC1pUkYDJS930tCA@mail.gmail.com
Whole thread Raw
In response to Re: acessibility for tables  (Kraus Philipp <philipp.kraus@flashpixx.de>)
Responses Re: acessibility for tables
List pgsql-general
Do you mean, you want everyone to see the data, but only the "owner" can

I would like to modify not only one field, but rather the whole record.
No problem, only don't let them change the owner
 
I thin NEW is the record of the view with the updated data and OLD the
orginal records (similar to trigger & stored procedure).
yes

I would like to set OLD to NEW if the owner field is correct like:
No need to do that. The UPDATE does this already. If you change NEW, then you are changing what the UPDATE does.


Can I do this with the rule on the view?
You could, but you should definitely look into triggers, like Albe said.

Also, you asked if this is a good idea.
Well, it works. But it is certainly not advisable to use the postgres authorisation system for anything else than postgres. I mean, don't try to use this for a  web site of sorts.
Then there are other ways to do it, if you really just want to make a database. Maybe inheritance could come in handy: a table per user and a parent table with select-only rights for all. (http://www.postgresql.org/docs/9.1/static/ddl-inherit.html)

HTH

WBL

--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: acessibility for tables
Next
From: Pavel Stehule
Date:
Subject: Re: column definition for setof record functions (like dblink and crosstabs)