Search Postgresql Archives

Re: Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello

2008/6/24 kartik <kartik@xxxxxxxxxxxxxxxxx>:
> Hello there
>
> Can anyone please tell me how to make a column uneditable….
>
> Plz  give me some output
>
> thans

try trigger

create table foo(
  a varchar
);

create function a_update_trg()
returns trigger as $$
begin
  if new.a is distinct from old.a then
    raise exception 'cannot change column a';
  end;
  return new;
end;
$$ language plpgsql;

create trigger foo_trg_update after update on foo for each row execute
procedure a_update_trg();

regards
Pavel Stehule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux