Re: [GENERAL] Read only column ?

2010-01-16 Thread Craig Ringer
On 17/01/2010 10:18 AM, John R Pierce wrote: Tom Lane wrote: Well, you could have the triggers throw errors instead of being silent about it. otoh, do you really want trigger code checking for permissions? ugh. Before column permissions, it was all you could do :-( I'm LOVING col permissio

Re: [GENERAL] Read only column ?

2010-01-16 Thread Tom Lane
"Gauthier, Dave" writes: > Triggers,throw errors? I didn't know they could do that. Other than via > "raise notice", how is this done? Could I capture such an error > programatically (e.g. in perl/DBI)? RAISE can do more than just notices ... regards, tom lane -- S

Re: [GENERAL] Read only column ?

2010-01-16 Thread Gauthier, Dave
nuary 16, 2010 9:18 PM To: Tom Lane Cc: Gauthier, Dave; pgsql-general@postgresql.org Subject: Re: [GENERAL] Read only column ? Tom Lane wrote: > Well, you could have the triggers throw errors instead of being silent > about it. > > otoh, do you really want trigger code ch

Re: [GENERAL] Read only column ?

2010-01-16 Thread Gauthier, Dave
2010 9:12 PM To: Gauthier, Dave Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Read only column ? "Gauthier, Dave" writes: >> .. although, if you have triggers forcibly setting the columns, it >> hardly matters what the users try to put into them, no? > U..

Re: [GENERAL] Read only column ?

2010-01-16 Thread John R Pierce
Tom Lane wrote: Well, you could have the triggers throw errors instead of being silent about it. otoh, do you really want trigger code checking for permissions? ugh. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.po

Re: [GENERAL] Read only column ?

2010-01-16 Thread Tom Lane
"Gauthier, Dave" writes: >> .. although, if you have triggers forcibly setting the columns, it >> hardly matters what the users try to put into them, no? > U. We I guess you have a point there :-) > Still, it would be nicer for the DB to tell them "DON'T TOUCH THAT" as > oppose

Re: [GENERAL] Read only column ?

2010-01-16 Thread Gauthier, Dave
osed to a trigger silently overriding whatever they may have thought they changed. -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Saturday, January 16, 2010 9:00 PM To: Gauthier, Dave Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Read only column ? "Gauthier,

Re: [GENERAL] Read only column ?

2010-01-16 Thread Tom Lane
"Gauthier, Dave" writes: > Is there a way to set a column to be read only? As of 8.4 you could revoke insert/update permissions column-by-column ... > I have a table with several columns with values that are determined by > triggers. I want users to be able to view, but never edit them. ... a

[GENERAL] Read only column ?

2010-01-16 Thread Gauthier, Dave
Is there a way to set a column to be read only? I have a table with several columns with values that are determined by triggers. I want users to be able to view, but never edit them. Thanks

Re: [GENERAL] Read-only column

2003-12-13 Thread Claudio Succa
Il sab, 2003-12-13 alle 15:48, Chris Travers ha scritto: > Or, depending if you just want to ignore updates to that field (not > always best, but possible, similar to a view). > > CREATE OR REPLACE FUNCTION block_col() > RETURNS TRIGGER AS ' > BEGIN > NEW.ts_field := OLD.ts_fie

Re: [GENERAL] Read-only column

2003-12-13 Thread Chris Travers
Or, depending if you just want to ignore updates to that field (not always best, but possible, similar to a view). CREATE OR REPLACE FUNCTION block_col() RETURNS TRIGGER AS ' BEGIN NEW.ts_field := OLD.ts_field; RETURN NEW; END; ' LANGUAGE PLPGSQL; I

Re: [GENERAL] Read-only column

2003-12-13 Thread Doug McNaught
Claudio Succa <[EMAIL PROTECTED]> writes: > (Not to reinvent the wheel, do you know where I could find a suitable > function to use in the trigger?) No, but it should be pretty trivial to write. Just set up a BEFORE UPDATE trigger that compares OLD.ts_field against NEW.ts_field and does a RAISE