Re: trigger or something else?
От | tolik@aaanet.ru (Anatoly K. Lasareff) |
---|---|
Тема | Re: trigger or something else? |
Дата | |
Msg-id | 87bt0mkr7y.fsf@tolikus.hq.aaanet.ru обсуждение исходный текст |
Ответ на | trigger or something else? ("Emils Klotins" <emils@dot.lv>) |
Список | pgsql-sql |
>>>>> "EK" == Emils Klotins <emils@dot.lv> writes: EK> Hello,EK> I have a table that has to have several fields with different names, EK> but equal content. Sounds stupid,but it is because I have 2 EK> different programs querying the same table for user information and EK> each of themuses differently named fields. EK> Eg. I have fields passwd and password.EK> When passwd field changes, password must automatically change EK> to be thesame as passwd. EK> I was wondering whether I need a trigger for that, or could I EK> somehow manage to specify that in the "create table"stmt. EK> If I need to do it via trigger, then I apparently need the plpgsql, right?EK> Could you tell which configure option enablesthat? --enable-EK> plpgsql? EK> Thanks in advamce for any comments. EK> Emils I suppose you can use view for your need. For example: create table a ( l varchar(30), p varchar(30) ); create view b as select l as login, p as password from a; insert into a values ('qq', 'ww'); select * from b; tolik=# select * from b;login | password -------+----------qq | ww (1 rows) Unfortunately this way suits for select only, not for 'insert into b' and 'update b' statement. -- Anatoly K. Lasareff Email: tolik@aaanet.ru
В списке pgsql-sql по дате отправления: