Re: [GENERAL] acessibility for tables

2012-06-07 Thread Philipp Kraus
Hi, I have recreated the view and the trigger function, now it works. I don't know why it does not run on my first try. My functions shows now: BEGIN IF TG_OP = 'INSERT' then insert into mytargettable values NEW; ELSIF TG_OP = 'UPDATE' then raise notice 'UPDATE trigger, OLD

Re: [GENERAL] acessibility for tables

2012-06-07 Thread Willy-Bas Loos
the error sounds clear enough. you should make a very simple test case that shows your problem (including some test data). then people on the list can help cheers, WBL On Thu, Jun 7, 2012 at 1:59 AM, Philipp Kraus wrote: > Hello, > > > On 2012-06-06 09:24:16 +0200, Albe Laurenz said: > > You c

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Philipp Kraus
Hello, On 2012-06-06 09:24:16 +0200, Albe Laurenz said: You can define INSTEAD OF triggers on a view so that you can insert, update and delete on it. The trigger performs an operation on the base table instead. I have created the trigger with "insead of". If I try to insert a row into the vi

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Philipp Kraus
Anfang der weitergeleiteten E-Mail: > Von: Willy-Bas Loos > Datum: 6. Juni 2012 13:57:45 MESZ > An: Kraus Philipp > Kopie: Albe Laurenz , pgsql-general@postgresql.org > Betreff: Re: [GENERAL] acessibility for tables > > Do you mean, you want everyone to see the data, but

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Willy-Bas Loos
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 (simi

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Albe Laurenz
Willy-Bas Loos wrote: > I did something like that some years ago. > Albe, are rules out of grace? Sort of, for many people: http://archives.postgresql.org/pgsql-hackers/2012-04/msg00395.php They are difficult to get right and usually not better than triggers. Ever since there were INSTEAD OF Trig

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Kraus Philipp
Hi Willey, you're great :-P Am 06.06.2012 um 13:12 schrieb Willy-Bas Loos: > I did something like that some years ago. > Albe, are rules out of grace? > > create or replace rule _update as on update > to view_firm1 do instead > update table1 set val = NEW.val where id=old.id; > > create or r

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Willy-Bas Loos
I did something like that some years ago. Albe, are rules out of grace? Philipp, here's some code: create role firm1 nologin; create role john password 'secret' login; grant firm1 to john; create role firm2 nologin; create role amy password 'secret' login; grant firm2 to amy; create table table1

Re: [GENERAL] acessibility for tables

2012-06-06 Thread Albe Laurenz
Kraus Philipp wrote: > I new on this mailing list and I need a little bit help for an idea to create different accesses to a > database with Postgres 9.1. > I'm using this PG version at the time and I have created a database with a scheme "storage". Within > this schema are some > tables, datatypes

[GENERAL] acessibility for tables

2012-06-05 Thread Kraus Philipp
Hello, I new on this mailing list and I need a little bit help for an idea to create different accesses to a database with Postgres 9.1. I'm using this PG version at the time and I have created a database with a scheme "storage". Within this schema are some tables, datatypes and stored procedure